Skip to content

Fix LLVM IR expectations for the autodiff generic test#156754

Open
sgasho wants to merge 1 commit into
rust-lang:mainfrom
sgasho:test-fix-codegen-llvm-autodiff
Open

Fix LLVM IR expectations for the autodiff generic test#156754
sgasho wants to merge 1 commit into
rust-lang:mainfrom
sgasho:test-fix-codegen-llvm-autodiff

Conversation

@sgasho
Copy link
Copy Markdown
Contributor

@sgasho sgasho commented May 19, 2026

Relax the LLVM IR checks for d_square::<f64> so they do not depend on the exact return type or argument ABI(which I don't think are necessary to check here) of the generated @diffe_ call.

Also add checks that square::<f64> is generated, since d_square::<f64> needs the f64 monomorphization even though square::<f64> is not called directly. I thought it seems natural to check it, but let me know if we do not need it.

I tested it works on my local(aarch64 mac) and dev-desktop(x86_64 linux)

aarch64 apple x86_64 linux
スクリーンショット 2026-05-20 0 08 44 スクリーンショット 2026-05-20 0 09 19

r? @ZuseZ4

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 19, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 19, 2026
// F64-NEXT: start:
// F64-NEXT: {{(tail )?}}call {{(fastcc )?}}void @diffe_{{.*}}(double {{.*}}, ptr {{.*}})
// F64-NEXT: ret void
// F64-NEXT: {{(tail )?}}call {{.*}} @diffe_{{.*}}
Copy link
Copy Markdown
Contributor Author

@sgasho sgasho May 19, 2026

Choose a reason for hiding this comment

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

I'm still learning what level of detail LLVM IR checks should usually assert.

Since the exact return type and arg types of the generated @diffe_ call seem somewhat fragile here, would it be better to avoid checking them?

Is it enough for this test to only check that a diffe_ function is called?

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants