summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2020-01-06 16:15:53 -0800
committerHeejin Ahn <aheejin@gmail.com>2020-01-06 17:02:32 -0800
commit21f7b362095f7497aa87ccc334fe18bbc072854c (patch)
treeab70010960c34574811698e8da6d2a41e2522659 /llvm/test/CodeGen/WebAssembly
parent52afc93c38c4dc6071172e2f580d364592d92dda (diff)
downloadbcm5719-llvm-21f7b362095f7497aa87ccc334fe18bbc072854c.tar.gz
bcm5719-llvm-21f7b362095f7497aa87ccc334fe18bbc072854c.zip
[WebAssembly] Fix landingpad-only case in Emscripten EH
Summary: Previously we didn't set `Changed` to true when there are only landing pads but not invokes. This fixes it and we set `Changed` to true whenever we have landing pads. (There can't be invokes without landing pads, so that case is covered too) The test case for this has to be a separate file because this pass is a `ModulePass` and `Changed` is computed based on the whole module. Reviewers: tlively Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72308
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly')
-rw-r--r--llvm/test/CodeGen/WebAssembly/lower-em-exceptions-lpad-only.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-lpad-only.ll b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-lpad-only.ll
new file mode 100644
index 00000000000..6d5f2e83654
--- /dev/null
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-lpad-only.ll
@@ -0,0 +1,25 @@
+; RUN: opt < %s -wasm-lower-em-ehsjlj -S | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+@_ZTIi = external constant i8*
+
+; Checks if a module that only contains a landingpad (and resume) but not an
+; invoke works correctly and does not crash.
+; CHECK-LABEL: @landingpad_only
+define void @landingpad_only() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+entry:
+ br label %cont
+
+lpad: ; preds = %entry
+ %0 = landingpad { i8*, i32 }
+ catch i8* bitcast (i8** @_ZTIi to i8*)
+ catch i8* null
+ resume { i8*, i32 } %0
+
+cont:
+ ret void
+}
+
+declare i32 @__gxx_personality_v0(...)
OpenPOWER on IntegriCloud