aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorCongcong Cai <congcongcai0907@163.com>2024-04-28 10:13:02 +0800
committerGitHub <noreply@github.com>2024-04-28 10:13:02 +0800
commit1a462296360f311d4593694aefd30c6b3e969460 (patch)
tree6fb2322c48d65b4cd624db8cbb1decd3565b652b /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parentad1e10ae1109fa7204ab70422bb611fe88391228 (diff)
downloadllvm-1a462296360f311d4593694aefd30c6b3e969460.zip
llvm-1a462296360f311d4593694aefd30c6b3e969460.tar.gz
llvm-1a462296360f311d4593694aefd30c6b3e969460.tar.bz2
Revert "Revert "[WebAssembly] remove instruction after builtin trap" (#90354)" (#90366)
`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: https://github.com/llvm/llvm-project/issues/68770 Reapply: #90207
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp4
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;
}