Repository navigation
Use an operand bundle for assume_nonnull in the LLVM backend - #166234
nnethercote wants to merge 2 commits into
Conversation
The sense is inverted.
But only for LLVM 23 onwards -- as of LLVM 23 the `InstCombine` pass rewrites the `icmp` form into the bundle form. In the common case this change means that we no longer generate this: ``` %29 = icmp ne ptr %_93, null call void @llvm.assume(i1 %29) ``` But instead generate this: ``` call void @llvm.assume(i1 true) [ "nonnull"(ptr %_93) ] ``` In the rare case (about 10x less common) we no longer generate this: ``` call void @llvm.assume(i1 true) ``` But instead generate this: ``` call void @llvm.assume(i1 true) [ "nonnull"(ptr @alloc_0c12d936522008f99725fd9502bec5dd) ] ``` This is because LLVM was previously able to fold a nonnull check on a global pointer (`icmp ne ptr @alloc_0c1..., null`) when rustc asked it to create the boolean value for the instruction form, but no longer does when it's in bundle form. But LLVM itself should easily fold it away, so I don't think this is a big deal.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use an operand bundle for `assume_nonnull` in the LLVM backend
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (163a657): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -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)Results (primary 0.5%, secondary 0.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 458.821s -> 461.585s (0.60%) |
|
This PR isn't intended to make the compiler faster. It's more a case of "LLVM is heading in the direction of using operand bundles for these assertions, so we might as well get with the program". |
Details in individual commits.
r? @scottmcm