Open patrick-rivos opened 5 months ago
X86 isn't expected to generally work with GlobalISel today. The generic intrinsic should have been translated as a generic instruction though
@llvm/issue-subscribers-backend-x86
Author: Patrick O'Neill (patrick-rivos)
No need in -flto
. It's enough to enforce global-isel
, e.g. -finstrument-functions -mllvm -global-isel
@llvm.returnaddress
is not supported expectedly when we try to select
define dso_local i32 @main() {
entry:
%0 = call ptr @llvm.returnaddress(i32 0)
call void @__cyg_profile_func_enter(ptr @main, ptr %0)
%1 = call ptr @llvm.returnaddress(i32 0)
call void @__cyg_profile_func_exit(ptr @main, ptr %1)
ret i32 0
}
AArch64 is able to compile but it keeps @llvm.returnaddress
through all the selection process. It seems that we need to introduce a new opcode. However we don't need to map it into ISD::RETURNADDR
as most targets have a custom lowering for it.
Testcase:
Backtrace (from godbolt):
Godbolt: https://godbolt.org/z/6K4j7W759 Works in LLVM 17.
Found via fuzzer
Possibly related to RISC-V failure: #88057