Rollup merge of #156461 - TimNN:retty, r=nikic

LLVM 23: Specify `returnaddress` intrinsic return type

https://github.com/llvm/llvm-project/pull/188464 made the return type of the intrinsic generic to support different pointer address spaces.

@rustbot label llvm-main
This commit is contained in:
Jonathan Brouwer
2026-05-11 23:03:09 +02:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -860,7 +860,14 @@ fn codegen_intrinsic_call(
_ => {
let ty = self.type_ix(32);
let val = self.const_int(ty, 0);
self.call_intrinsic("llvm.returnaddress", &[], &[val])
let type_params: &[&'ll Type] = if llvm_version < (23, 0, 0) {
&[]
} else {
&[self.type_ptr()]
};
self.call_intrinsic("llvm.returnaddress", type_params, &[val])
}
}
}
@@ -7,6 +7,6 @@
#[no_mangle]
#[inline(never)]
pub fn call_return_address_intrinsic() -> *const () {
// CHECK: call ptr @llvm.returnaddress(i32 0)
// CHECK: call ptr @llvm.returnaddress{{(.p0)?}}(i32 0)
core::intrinsics::return_address()
}