summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 3aa25932f84..66976a77892 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -165,7 +165,14 @@ void WebAssemblyPassConfig::addIRPasses() {
if (getOptLevel() != CodeGenOpt::None)
addPass(createWebAssemblyOptimizeReturned());
- // Handle exceptions.
+ // If exception handling is not enabled, we lower invokes into calls and
+ // simplify CFG to delete unreachable landingpad blocks.
+ if (!EnableEmException) {
+ addPass(createLowerInvokePass());
+ addPass(createCFGSimplificationPass());
+ }
+
+ // Handle exceptions and setjmp/longjmp if enabled.
if (EnableEmException || EnableEmSjLj)
addPass(createWebAssemblyLowerEmscriptenEHSjLj(EnableEmException,
EnableEmSjLj));
OpenPOWER on IntegriCloud