aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorMatt Harding <majaharding@gmail.com>2023-10-05 17:17:45 +0100
committerGitHub <noreply@github.com>2023-10-05 09:17:45 -0700
commitbd7ca98b66700925625ae84aa1083e94a3b875aa (patch)
tree0ec45800a8a69b4dccdd2be1094fc219adb7414d /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parent6b31b026006ee688019e7cf762ab1641df8ff8f6 (diff)
downloadllvm-bd7ca98b66700925625ae84aa1083e94a3b875aa.zip
llvm-bd7ca98b66700925625ae84aa1083e94a3b875aa.tar.gz
llvm-bd7ca98b66700925625ae84aa1083e94a3b875aa.tar.bz2
Ensure NoTrapAfterNoreturn is false for the wasm backend (#65876)
In the WebAssembly back end, the TrapUnreachable option is currently load-bearing for correctness, inserting wasm `unreachable` instructions where needed to create valid wasm. There is another option, NoTrapAfterNoreturn, that removes some of those traps and causes incorrect wasm to be emitted. This turns off `NoTrapAfterNoreturn` for the Wasm backend and adds new tests.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 10464e8..88c7277 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -127,6 +127,7 @@ WebAssemblyTargetMachine::WebAssemblyTargetMachine(
// LLVM 'unreachable' to ISD::TRAP and then lower that to WebAssembly's
// 'unreachable' instructions which is meant for that case.
this->Options.TrapUnreachable = true;
+ this->Options.NoTrapAfterNoreturn = false;
// WebAssembly treats each function as an independent unit. Force
// -ffunction-sections, effectively, so that we can emit them independently.