Skip to content

Commit

Permalink
test: di_generics: Ensure that my_function call isn't optimized out
Browse files Browse the repository at this point in the history
The previous code, which wasn't making any use of the return value of
`my_function`, was optimized out after upgrading to LLVM 20. Using the
return value prevents that.
  • Loading branch information
vadorovsky authored and tamird committed Feb 19, 2025
1 parent cc4d854 commit b76efc8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/assembly/di_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ static mut BAR: Bar<Foo<u32>> = Bar { x: Foo { x: 0 } };

#[no_mangle]
#[link_section = "uprobe/connect"]
pub fn connect() {
let _ = my_function(1, 2);
let _ = my_function(3, 4);
let _ = my_function(5, 6);
let _ = my_function(7, 8);
pub fn connect() -> u32 {
my_function(1, 2)
}

pub trait Add<Rhs = Self> {
Expand Down

0 comments on commit b76efc8

Please sign in to comment.