Skip to content

LLVM 23: Adapt codegen test to moved assume#158067

Open
TimNN wants to merge 1 commit into
rust-lang:mainfrom
TimNN:moved-assume
Open

LLVM 23: Adapt codegen test to moved assume#158067
TimNN wants to merge 1 commit into
rust-lang:mainfrom
TimNN:moved-assume

Conversation

@TimNN

@TimNN TimNN commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

I wasn't completely sure what the important part of this test is - based on the "Make sure we don't create br or select instructions" comment I assume it's that the load is followed ~immediately by the ret, and that the presence or absence of the assume doesn't really matter (it's been moved up a few lines to before the load):

; Function Attrs
define noundef i32 @foo(ptr noalias nofree noundef align 8 captures(none) dereferenceable(16) %x) unnamed_addr #0 { 
start
 %_6 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4 
 %0 = getelementptr inbounds nuw i8, ptr %x, i64 8 
 %_7 = load ptr, ptr %0, align 8, !nonnull !4, !noundef !4 
 %_8 = icmp ne ptr %_6, %_7 
 tail call void @llvm.assume(i1 %_8) 
 %_14 = getelementptr inbounds nuw i8, ptr %_6, i64 4 
 store ptr %_14, ptr %x, align 8 
 %_4 = load i32, ptr %_6, align 4, !noundef !4 
 ret i32 %_4 
} 

(If you have a suggestion for how to adapt the test without introducing revisions, I'd be happy to do so).

@rustbot label llvm-main

original CI failure

@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. labels Jun 18, 2026
@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

r? @mu001999

rustbot has assigned @mu001999.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rustbot rustbot added the llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) label Jun 18, 2026
@mu001999

mu001999 commented Jun 18, 2026

Copy link
Copy Markdown
Member

r? dianqk (creator of this test)

@rustbot rustbot assigned dianqk and unassigned mu001999 Jun 18, 2026
@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

dianqk is currently at their maximum review capacity.
They may take a while to respond.

//@ [new] min-llvm-version: 23

// Test for #107681.
// Make sure we don't create `br` or `select` instructions.

This comment was marked as duplicate.

// CHECK: [[RET:%.*]] = load i32, ptr
// CHECK-NEXT: assume
// old-NEXT: assume
// CHECK-NEXT: ret i32 [[RET]]

@dianqk dianqk Jun 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these checks can be changed to something like:

// CHECK: [[INNER:%.*]] = load ptr, ptr %x
// CHECK: [[RET:%.*]] = load i32, ptr [[INNER]]

You can remove or add more CHECK-NOT br or CHECK-NOT select.

View changes since the review

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