Skip to content

Conversation

durin42
Copy link
Contributor

@durin42 durin42 commented Sep 18, 2025

LLVM 22 is able to drop assumes that seem to not help further optimizations, which actually seems to dramatically help further optimizations in some of our small test cases.

I'm a little unclear how to fix the last failure, in tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs:

-; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: write) uwtable
+; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(argmem: readwrite, inaccessiblemem: write) uwtable
 define void @update(ptr noundef captures(none) %s) unnamed_addr #0 {
 start:
-  %_3.sroa.0.0.copyload = load i8, ptr %s, align 1
-  %0 = trunc nuw i8 %_3.sroa.0.0.copyload to i1
-  %1 = xor i1 %0, true
-  tail call void @llvm.assume(i1 %1)
   store i8 1, ptr %s, align 1
   ret void
 }

I'm just not conversant enough in LLVM IR to follow the changes here.

@rustbot label llvm-main
r? nikic

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) labels Sep 18, 2025
@rust-log-analyzer

This comment has been minimized.

@durin42
Copy link
Contributor Author

durin42 commented Sep 18, 2025

@rustbot label +S-waiting-on-author -S-waiting-on-review

Well that's annoying, I'll have to figure out how to make it pass on LLVM 21 as well as 22.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2025
LLVM 22 is able to drop assumes that seem to not help further
optimizations, which actually seems to dramatically _help_ further
optimizations in some of our small test cases.
@durin42 durin42 force-pushed the llvm-22-less-assumes branch from 8f97242 to e32b975 Compare September 19, 2025 17:56
@durin42
Copy link
Contributor Author

durin42 commented Sep 19, 2025

Updated, all three tests should now pass on LLVM 22+ and LLVM < 22. I decided to just accept the two disappeared instructions in issue-122600-ptr-discriminant-update.rs since it sounds like the CHECK-NOT bits were the actually-important parts.

@durin42
Copy link
Contributor Author

durin42 commented Sep 19, 2025

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants