Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/codegen-llvm/autodiff/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,17 @@ fn square<T: std::ops::Mul<Output = T> + Copy>(x: &T) -> T {
// F64-NEXT: ; Function Attrs: {{.*}}
// F64-NEXT: define internal {{.*}} void
// 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

// F64: ret void

// Ensure that `square::<f64>` is generated so that it can be differentiated

// F64-LABEL: ; generic::square::<f64>
// F64-NEXT: ; Function Attrs: {{.*}}
// F64-NEXT: define internal {{.*}} double
// F64-NEXT: start:
// F64-NOT: ret
// F64: fmul double

// Main-LABEL: ; generic::main
// Main: ; call generic::square::<f32>
Expand Down
Loading