diff options
author | Congcong Cai <congcongcai0907@163.com> | 2024-04-27 22:11:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-27 22:11:47 +0800 |
commit | ff03f23be8bc6df701efd9e1093779fbcf382d87 (patch) | |
tree | 2377f62319a83cc3904fa8f98ecc71cee0cc214b /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | |
parent | 7b5b5214a6f905be67e3c2ecb9b4887eaa3406c3 (diff) | |
download | llvm-ff03f23be8bc6df701efd9e1093779fbcf382d87.zip llvm-ff03f23be8bc6df701efd9e1093779fbcf382d87.tar.gz llvm-ff03f23be8bc6df701efd9e1093779fbcf382d87.tar.bz2 |
[WebAssembly] remove instruction after builtin trap (#90207)
`llvm.trap` will be convert as `unreachable` which is terminator.
Instruction after terminator will cause validation failed.
This PR introduces a pass to clean instruction after terminator.
Fixes: #68770.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index cdd39ee..de342e8 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -512,6 +512,10 @@ bool WebAssemblyPassConfig::addInstSelector() { // Eliminate range checks and add default targets to br_table instructions. addPass(createWebAssemblyFixBrTableDefaults()); + // unreachable is terminator, non-terminator instruction after it is not + // allowed. + addPass(createWebAssemblyCleanCodeAfterTrap()); + return false; } |