Skip to content

Commit ba7369c

Browse files
authored
WebAssembly: Move runtime libcall setting out of TargetLowering (#142624)
RuntimeLibcallInfo needs to be correct outside of codegen contexts.
1 parent f23b841 commit ba7369c

File tree

4 files changed

+5
-29
lines changed

4 files changed

+5
-29
lines changed

lld/test/wasm/lto/Inputs/libcall-return-addr.ll

Lines changed: 0 additions & 6 deletions
This file was deleted.

lld/test/wasm/lto/libcall-return-addr.ll

Lines changed: 0 additions & 18 deletions
This file was deleted.

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
531531
setLibcallName(RTLIB::MULO_I64, nullptr);
532532
}
533533
setLibcallName(RTLIB::MULO_I128, nullptr);
534+
} else {
535+
// Define the emscripten name for return address helper.
536+
// TODO: when implementing other Wasm backends, make this generic or only do
537+
// this on emscripten depending on what they end up doing.
538+
setLibcallName(RTLIB::RETURN_ADDRESS, "emscripten_return_address");
534539
}
535540

536541
if (TT.isSystemZ() && TT.isOSzOS()) {

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,6 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
385385

386386
setMaxAtomicSizeInBitsSupported(64);
387387

388-
// Define the emscripten name for return address helper.
389-
// TODO: when implementing other Wasm backends, make this generic or only do
390-
// this on emscripten depending on what they end up doing.
391-
setLibcallName(RTLIB::RETURN_ADDRESS, "emscripten_return_address");
392-
393388
// Always convert switches to br_tables unless there is only one case, which
394389
// is equivalent to a simple branch. This reduces code size for wasm, and we
395390
// defer possible jump table optimizations to the VM.

0 commit comments

Comments
 (0)