LLVM: fix invalid IR on @returnAddress of wasm/bpf

see #11946
This commit is contained in:
Andrew Kelley
2022-06-27 17:12:45 -07:00
parent 8d8a5f9733
commit 3c1daf951c
4 changed files with 20 additions and 5 deletions

View File

@@ -6764,8 +6764,8 @@ static LLVMValueRef ir_render_return_address(CodeGen *g, Stage1Air *executable,
Stage1AirInstReturnAddress *instruction)
{
if ((target_is_wasm(g->zig_target) && g->zig_target->os != OsEmscripten) || target_is_bpf(g->zig_target)) {
// I got this error from LLVM 10:
// "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address"
// LLVM 13 reports "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address"
// https://github.com/ziglang/zig/issues/11946
return LLVMConstNull(get_llvm_type(g, instruction->base.value->type));
}