diff options
| author | Heejin Ahn <aheejin@gmail.com> | 2019-10-01 06:21:53 +0000 |
|---|---|---|
| committer | Heejin Ahn <aheejin@gmail.com> | 2019-10-01 06:21:53 +0000 |
| commit | 61d5c76a181360ca8f039b2f6c914a18540684b5 (patch) | |
| tree | a64ab6feb4a6ad459956348462b89c258a127c4a /llvm/test/CodeGen | |
| parent | 5b5274eaf8c26064b6d10b43171f6252c10f576e (diff) | |
| download | bcm5719-llvm-61d5c76a181360ca8f039b2f6c914a18540684b5.tar.gz bcm5719-llvm-61d5c76a181360ca8f039b2f6c914a18540684b5.zip | |
[WebAssembly] Unstackify regs after fixing unwinding mismatches
Summary:
Fixing unwind mismatches for exception handling can result in splicing
existing BBs and moving some of instructions to new BBs. In this case
some of stackified def registers in the original BB can be used in the
split BB. For example, we have this BB and suppose %r0 is a stackified
register.
```
bb.1:
%r0 = call @foo
... use %r0 ...
```
After fixing unwind mismatches in CFGStackify, `bb.1` can be split and
some instructions can be moved to a newly created BB:
```
bb.1:
%r0 = call @foo
bb.split (new):
... use %r0 ...
```
In this case we should make %r0 un-stackified, because its use is now in
another BB.
When spliting a BB, this CL unstackifies all def registers that have
uses in the new split BB.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68218
llvm-svn: 373301
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll b/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll index 9cb5a057ef1..104e324faae 100644 --- a/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll +++ b/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll @@ -436,13 +436,17 @@ try.cont: ; preds = %catch.start1, %catc ; the right destination (label4), from which we rethrow the exception to the ; caller. +; And the return value of 'baz' should NOT be stackified because the BB is split +; during fixing unwind mismatches. + ; NOSORT-LABEL: test6 ; NOSORT: try ; NOSORT: call foo ; --- Nested try/catch/end_try starts ; NOSORT: try ; NOSORT: call bar -; NOSORT: call bar +; NOSORT: i32.call ${{[0-9]+}}=, baz +; NOSORT-NOT: i32.call $push{{.*}}=, baz ; NOSORT: catch $[[REG:[0-9]+]]= ; NOSORT: br 1 # 1: down to label35 ; NOSORT: end_try @@ -460,7 +464,8 @@ bb0: bb1: ; preds = %bb0 call void @bar() - call void @bar() + %call = call i32 @baz() + call void @nothrow(i32 %call) #0 ret void catch.dispatch0: ; preds = %bb0 @@ -618,6 +623,9 @@ try.cont: ; preds = %catch.start1, %catc declare void @foo() declare void @bar() +declare i32 @baz() +; Function Attrs: nounwind +declare void @nothrow(i32) #0 declare i32 @__gxx_wasm_personality_v0(...) declare i8* @llvm.wasm.get.exception(token) declare i32 @llvm.wasm.get.ehselector(token) @@ -627,3 +635,5 @@ declare i8* @__cxa_begin_catch(i8*) declare void @__cxa_end_catch() declare void @__clang_call_terminate(i8*) declare void @_ZSt9terminatev() + +attributes #0 = { nounwind } |

