-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM 20 #22780
+60,803
−25,487
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58b5963
to
68de6ef
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
9aa51aa
to
07a9111
Compare
This is now green on |
9095043
to
64bcbda
Compare
f234cbe
to
04d8fa6
Compare
69126d0
to
86ab5fb
Compare
This ABI bug was fixed in LLVM 20.
LLVM 20 started tail-calling it in some of our test cases, resulting in: error: AndMyCarIsOutOfGas /home/alexrp/Source/ziglang/zig-llvm20/repro.zig:2:5: 0x103ef9d in main (repro) return error.TheSkyIsFalling; ^ /home/alexrp/Source/ziglang/zig-llvm20/repro.zig:6:5: 0x103efa5 in main (repro) return error.AndMyCarIsOutOfGas; ^ /home/alexrp/Source/ziglang/zig-llvm20/lib/std/start.zig:656:37: 0x103ee83 in posixCallMainAndExit (repro) const result = root.main() catch |err| { ^ instead of the expected: error: AndMyCarIsOutOfGas /home/alexrp/Source/ziglang/zig-llvm20/repro.zig:2:5: 0x103f00d in main (repro) return error.TheSkyIsFalling; ^ /home/alexrp/Source/ziglang/zig-llvm20/repro.zig:6:5: 0x103f015 in main (repro) return error.AndMyCarIsOutOfGas; ^ /home/alexrp/Source/ziglang/zig-llvm20/repro.zig:11:9: 0x103f01d in main (repro) try bar(); ^
We can now run these tests as part of test-modules w/o -Dtest-slow-targets. Closes #21096.
…rectories` tests for mips64(el). These started failing with LLVM 20 for unclear reasons: test-std └─ run test std-mips64-linux.4.19...6.13.4-gnuabi64.2.28-mips64r2-Debug-libc 2798/2878 passed, 2 failed, 78 skipped error: 'posix.test.test.link with relative paths' failed: expected 2, found 0 /home/alexrp/Source/ziglang/zig-llvm20/lib/std/testing.zig:103:17: 0x1d9e5bf in expectEqualInner__anon_47031 (test) return error.TestExpectedEqual; ^ /home/alexrp/Source/ziglang/zig-llvm20/lib/std/posix/test.zig:311:9: 0x3650f57 in test.link with relative paths (test) try testing.expectEqual(@as(@typeof(nstat.nlink), 2), nstat.nlink); ^ error: 'posix.test.test.linkat with different directories' failed: expected 2, found 0 /home/alexrp/Source/ziglang/zig-llvm20/lib/std/testing.zig:103:17: 0x1d9e5bf in expectEqualInner__anon_47031 (test) return error.TestExpectedEqual; ^ /home/alexrp/Source/ziglang/zig-llvm20/lib/std/posix/test.zig:355:9: 0x3653377 in test.linkat with different directories (test) try testing.expectEqual(@as(@typeof(nstat.nlink), 2), nstat.nlink); ^ error: while executing test 'zig.system.darwin.macos.test.detect', the following test command failed: qemu-mips64 -L /opt/glibc/mips64-linux-gnu-n64 /home/alexrp/Source/ziglang/zig-llvm20/.zig-cache/o/22a8c3762ea56ae3a674fa9ad15f6657/test --seed=0xa1dbb43c --cache-dir=/home/alexrp/Source/ziglang/zig-llvm20/.zig-cache --listen=- test-std └─ run test std-mips64-linux.4.19...6.13.4-gnuabi64.2.28-mips64r2-Debug-libc 2798/2878 passed, 1 failed, 79 skipped error: 'posix.test.test.linkat with different directories' failed: expected 2, found 0 /home/alexrp/Source/ziglang/zig-llvm20/lib/std/testing.zig:103:17: 0x1d9e22f in expectEqualInner__anon_47031 (test) return error.TestExpectedEqual; ^ /home/alexrp/Source/ziglang/zig-llvm20/lib/std/posix/test.zig:356:9: 0x3650b47 in test.linkat with different directories (test) try testing.expectEqual(@as(@typeof(nstat.nlink), 2), nstat.nlink); ^ error: while executing test 'zig.system.darwin.macos.test.detect', the following test command failed: qemu-mips64 -L /opt/glibc/mips64-linux-gnu-n64 /home/alexrp/Source/ziglang/zig-llvm20/.zig-cache/o/22a8c3762ea56ae3a674fa9ad15f6657/test --seed=0xa1dbb43c --cache-dir=/home/alexrp/Source/ziglang/zig-llvm20/.zig-cache --listen=- Unfortunately, neither GDB nor LLDB want to play nice with qemu-mips64(el) at the moment, so I can't easily debug these failures.
This can be used more broadly for targets that aren't quite ready to be tested by default yet.
We build zig2.c and compiler_rt.c with -O0 but then proceed to link with -O3. So zig2.o and compiler_rt.o will have references to ubsan-rt symbols, but the -O3 causes the compiler to not link ubsan-rt. We don't actually need the safety here, so just explicitly disable ubsan.
… macos. This started failing in LLVM 20: test +- test-stack-traces +- check error union switch with call operand (ReleaseSafe llvm) failure error: ========= expected this stdout: ========= error: TheSkyIsFalling source.zig:3:5: [address] in [function] return error.TheSkyIsFalling; ^ ========= but found: ==================== error: TheSkyIsFalling source.zig:13:27: [address] in [function] error.NonFatal => return, ^
these have assertions enabled
andrewrk
approved these changes
Apr 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work.
This makes me wonder if we should define noinline
to also disable tail calls. 🤔
This was referenced Apr 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backend-llvm
The LLVM backend outputs an LLVM IR Module.
release notes
This PR should be mentioned in the release notes.
zig cc
Zig as a drop-in C compiler feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently targeting LLVM 20.1.2.
Test suite status:
test-fmt
: ✔️test-cases
: ✔️test-translate-c
: ✔️test-run-translated-c
: ✔️test-behavior
: ✔️test-c-import
: ✔️test-compiler-rt
: ✔️test-universal-libc
: ✔️test-std
: ✔️test-unit
: ✔️test-compare-output
: ✔️test-standalone
: ✔️test-c-abi
: ✔️test-link
: ✔️test-stack-traces
: ✔️test-cli
: ✔️test-asm-link
: ✔️test-debugger
: ✔️test-incremental
: ✔️Bugs filed upstream:
llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"
when building musl formips64-linux-muslabi64
with Clang 20.1.0-rc1 llvm/llvm-project#125954llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"
when using@llvm.usub.with.overflow
on Hexagon llvm/llvm-project#127296llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"
forload volatile
from hardcoded pointer onpowerpc-linux-musleabihf
llvm/llvm-project#127298@llvm.ctpop.i128
foraarch64_be
llvm/llvm-project#129843ldexp
implementation forx86_fp80
llvm/llvm-project#130408isFullyInternal()
llvm/llvm-project#130541Closes #22014.