Skip to content

Commit b76efc8

Browse files
vadorovskytamird
authored andcommitted
test: di_generics: Ensure that my_function call isn't optimized out
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.
1 parent cc4d854 commit b76efc8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tests/assembly/di_generics.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ static mut BAR: Bar<Foo<u32>> = Bar { x: Foo { x: 0 } };
2828

2929
#[no_mangle]
3030
#[link_section = "uprobe/connect"]
31-
pub fn connect() {
32-
let _ = my_function(1, 2);
33-
let _ = my_function(3, 4);
34-
let _ = my_function(5, 6);
35-
let _ = my_function(7, 8);
31+
pub fn connect() -> u32 {
32+
my_function(1, 2)
3633
}
3734

3835
pub trait Add<Rhs = Self> {

0 commit comments

Comments
 (0)