Uh oh!
There was an error while loading. Please reload this page.
tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs: New test - #149658
Conversation
rustbot
commented
Dec 4, 2025
rustbot has assigned @Mark-Simulacrum. Use |
clubby789
commented
Dec 6, 2025
I think this should be a |
Enselic
commented
Dec 9, 2025
Good call. That deserves consideration. Here is what the correct LLVM IR currently looks like: ; Function Attrs: mustprogress nofree norecurse nounwind nonlazybind willreturn memory(readwrite, argmem: none, inaccessiblemem: write)define noundef range(i641, 0) i64@some_non_zero_from_atomic_get() unnamed_addr #0 {
start:
%0 = loadatomici64, ptr@_ZN38some_non_zero_from_atomic_optimization1X17h41fcdb7c72ef9763Emonotonic, align8%1 = icmpnei64%0, 0tailcallvoid@llvm.assume(i1%1)
reti64%0
}Full LLVM IR; ModuleID = 'some_non_zero_from_atomic_optimization.ca4055969c8517ab-cgu.0'
source_filename = "some_non_zero_from_atomic_optimization.ca4055969c8517ab-cgu.0"targetdatalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"targettriple = "x86_64-unknown-linux-gnu"@_ZN38some_non_zero_from_atomic_optimization1X17h41fcdb7c72ef9763E = local_unnamed_addrglobal [8 x i8] c"\07\00\00\00\00\00\00\00", align8@some_non_zero_from_atomic_get2 = unnamed_addraliasi64 (), ptr@some_non_zero_from_atomic_get; Function Attrs: mustprogress nofree norecurse nounwind nonlazybind willreturn memory(readwrite, argmem: none, inaccessiblemem: write)define noundef range(i641, 0) i64@some_non_zero_from_atomic_get() unnamed_addr #0 {
start:
%0 = loadatomici64, ptr@_ZN38some_non_zero_from_atomic_optimization1X17h41fcdb7c72ef9763Emonotonic, align8%1 = icmpnei64%0, 0tailcallvoid@llvm.assume(i1%1)
reti64%0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)declarevoid@llvm.assume(i1 noundef) #1attributes #0 = { mustprogress nofree norecursenounwindnonlazybind willreturn memory(readwrite, argmem: none, inaccessiblemem: write) "probe-stack"="inline-asm""target-cpu"="x86-64" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
!llvm.module.flags = !{!0, !1}
!llvm.ident = !{!2}
!0 = !{i328, !"PIC Level", i322}
!1 = !{i322, !"RtLibUseGOT", i321}
!2 = !{!"rustc version 1.91.1 (ed61e7d7e 2025-11-07)"}As you can see, the LLVM IR is considerably more elaborate and is likely to change over time as we adjust codegen and adapt to new LLVM versions. So an LLVM IR version of this test risks becoming a maintenance burden that will steal time from doing other improvements. Besides, it does not seem impossible that this optimization could regress on the LLVM side, which an LLVM IR based test would not catch. So my recommendation is to go ahead with this test, because it tests what actually matters (the end result) and that is unlikely to ever change. That said, I can certainly turn this into an LLVM test if that is considered mandatory for merge. We can wait and see see what others think perhaps. |
Mark-Simulacrum
commented
Dec 20, 2025
@bors r+ I don't think it has to check the LLVM IR necessarily. |
bors
commented
Dec 20, 2025
…acrum tests/assembly-llvm/some-non-zero-from-atomic-optimization.rs: New test Closesrust-lang#60044 which has one 👍 and one ❤️ vote and just **E-needs-test**.
Rollup of 13 pull requests Successful merges: - #146377 (Don't strip shebang in expr-ctxt `include!(…)`) - #149437 (Fix trailing newline in JUnit formatter) - #149658 (tests/assembly-llvm/some-non-zero-from-atomic-optimization.rs: New test) - #149812 (Add const default for OnceCell and OnceLock) - #149882 (miri: add -Zbinary-dep-depinfo to dependency builds) - #150009 (Enable llvm-libunwind by default for Hexagon targets) - #150035 (fix docustring on fetch_or) - #150082 (tests/ui/traits/fmt-pointer-trait.rs: Add HRTB fn pointer case) - #150160 (Fix ICE (#149980) for invalid EII in statement position) - #150184 (mir_build: Use the same length type for `TestableCase::Slice` and `TestKind::Len`) - #150191 (change non-canonical clone impl to {*self}, fix some doc comments) - #150203 (Drop the From derive macro from the v1 prelude) - #150208 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
…acrum tests/assembly-llvm/some-non-zero-from-atomic-optimization.rs: New test Closesrust-lang#60044 which has one 👍 and one ❤️ vote and just **E-needs-test**.
Rollup of 11 pull requests Successful merges: - #146377 (Don't strip shebang in expr-ctxt `include!(…)`) - #149658 (tests/assembly-llvm/some-non-zero-from-atomic-optimization.rs: New test) - #149812 (Add const default for OnceCell and OnceLock) - #149882 (miri: add -Zbinary-dep-depinfo to dependency builds) - #150009 (Enable llvm-libunwind by default for Hexagon targets) - #150035 (fix docustring on fetch_or) - #150082 (tests/ui/traits/fmt-pointer-trait.rs: Add HRTB fn pointer case) - #150160 (Fix ICE (#149980) for invalid EII in statement position) - #150184 (mir_build: Use the same length type for `TestableCase::Slice` and `TestKind::Len`) - #150191 (change non-canonical clone impl to {*self}, fix some doc comments) - #150203 (Drop the From derive macro from the v1 prelude) r? `@ghost` `@rustbot` modify labels: rollup
JonathanBrouwer
commented
Dec 21, 2025
clubby789
commented
Dec 21, 2025
vs |
JonathanBrouwer
commented
Dec 22, 2025
@bors try jobs=x86_64-gnu-llvm-20-3 |
This comment has been minimized.
This comment has been minimized.
tests/assembly-llvm/some-non-zero-from-atomic-optimization.rs: New test try-job: x86_64-gnu-llvm-20-3
Uh oh!
There was an error while loading. Please reload this page.
nikic
commented
Dec 22, 2025
As you are currently finding out, the reason we test codegen instead of assembly is that assembly tests are even more fragile :) For cases like this, you don't really need to check the exact emitted IR, something like You can use |
Enselic
commented
Dec 22, 2025
Ok I have now been convinced that we should use an LLVM IR test instead :) I am not relaxed enough with FileCheck to be comfortable with some |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Enselic
commented
Dec 23, 2025
@rustbot ready |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Thanks for the feedback. I have now turned this into a "not panic" and "not unreachable" test and made sure that it will catch a regression. The test fails with nightly-2024-02-08: $ rustc +nightly-2024-02-08 --emit=llvm-ir -O -Zmerge-functions=disabled \ tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs && \/usr/lib/llvm-20/bin/FileCheck \ tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs \ <some-non-zero-from-atomic-optimization.lltests/codegen-llvm/some-non-zero-from-atomic-optimization.rs:76:15: error: CHECK-NOT: excluded string found in input// CHECK-NOT: panic ^<stdin>:26:14: note: found here; call core::panicking::panic ^~~~~tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs:77:15: error: CHECK-NOT: excluded string found in input// CHECK-NOT: unreachable ^<stdin>:28:2: note: found here unreachable ^~~~~~~~~~~but passes with nightly-2024-02-09: $ rustc +nightly-2024-02-09 --emit=llvm-ir -O -Zmerge-functions=disabled \ tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs && \/usr/lib/llvm-20/bin/FileCheck \ tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs \ <some-non-zero-from-atomic-optimization.ll && \echo passpassAs you can see above I did a bisect and it was fixed in nightly-2024-02-09. Here is the set of candidate commits that fixed it. See #60044 (comment) for a guess on which one it was. git log ^8ace7ea1f7cbba7b4f031e66c54ca237a0d65de6 98aa362 --no-merges --onelinead511ef Avoid ICE in drop recursion check in case of invalid drop impls @rustbot ready |
Mark-Simulacrum
commented
Jan 2, 2026
@bors r+ |
bors
commented
Jan 2, 2026
bors
commented
Jan 2, 2026
bors
commented
Jan 2, 2026
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 8a24a20 (parent) -> 5497a36 (this PR) Test differencesShow 6 test diffsStage 1
Stage 2
Additionally, 2 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 5497a36a7faf3d2af37beebcff7008e493202902 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
rust-timer
commented
Jan 2, 2026
Finished benchmarking commit (5497a36): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (secondary 4.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 473.485s -> 471.287s (-0.46%) |
Closes#60044 which has one 👍 and one ❤️ vote and just E-needs-test.