summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2018-08-21 21:23:07 +0000
committerHeejin Ahn <aheejin@gmail.com>2018-08-21 21:23:07 +0000
commit78d191089182842f6360547c48993e44de9e1437 (patch)
tree4c74fb81a64effca22778f64765ad7585e9630b6 /llvm/test/CodeGen
parent1d78503f6a3c71d9862d5009224cba27b237a883 (diff)
downloadbcm5719-llvm-78d191089182842f6360547c48993e44de9e1437.tar.gz
bcm5719-llvm-78d191089182842f6360547c48993e44de9e1437.zip
[WebAssembly] Restore __stack_pointer after catch instructions
Summary: After the stack is unwound due to a thrown exception, the `__stack_pointer` global can point to an invalid address. This inserts instructions that restore `__stack_pointer` global. Reviewers: jgravelle-google, dschuff Subscribers: mgorny, sbc100, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D50980 llvm-svn: 340339
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/WebAssembly/exception.ll5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/exception.ll b/llvm/test/CodeGen/WebAssembly/exception.ll
index 2519ffcc78c..a0256d23891 100644
--- a/llvm/test/CodeGen/WebAssembly/exception.ll
+++ b/llvm/test/CodeGen/WebAssembly/exception.ll
@@ -19,9 +19,11 @@ define void @test_throw() {
}
; CHECK-LABEL: test_catch_rethrow:
+; CHECK: get_global $push{{.+}}=, __stack_pointer@GLOBAL
; CHECK: try
; CHECK: call foo@FUNCTION
; CHECK: i32.catch $push{{.+}}=, 0
+; CHECK: set_global __stack_pointer@GLOBAL
; CHECK-DAG: i32.store __wasm_lpad_context
; CHECK-DAG: i32.store __wasm_lpad_context+4
; CHECK: i32.call $push{{.+}}=, _Unwind_CallPersonality@FUNCTION
@@ -63,6 +65,7 @@ try.cont: ; preds = %entry, %catch
; CHECK: try
; CHECK: call foo@FUNCTION
; CHECK: catch_all
+; CHECK: set_global __stack_pointer@GLOBAL
; CHECK: i32.call $push{{.+}}=, _ZN7CleanupD1Ev@FUNCTION
; CHECK: rethrow
; CHECK: end_try
@@ -161,10 +164,12 @@ terminate10: ; preds = %ehcleanup7
; CHECK: call foo@FUNCTION
; CHECK: i32.catch
; CHECK-NOT: get_global $push{{.+}}=, __stack_pointer@GLOBAL
+; CHECK: set_global __stack_pointer@GLOBAL
; CHECK: try
; CHECK: call foo@FUNCTION
; CHECK: catch_all
; CHECK-NOT: get_global $push{{.+}}=, __stack_pointer@GLOBAL
+; CHECK: set_global __stack_pointer@GLOBAL
; CHECK: call __cxa_end_catch@FUNCTION
; CHECK-NOT: set_global __stack_pointer@GLOBAL, $pop{{.+}}
; CHECK: end_try
OpenPOWER on IntegriCloud