[WebAssembly] Unstackify regs after fixing unwinding mismatches
authorHeejin Ahn <aheejin@gmail.com>
Tue, 1 Oct 2019 06:21:53 +0000 (06:21 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Tue, 1 Oct 2019 06:21:53 +0000 (06:21 +0000)
commitd103507e8216170dbc656ed31baa0cc4f5978c27
treeba2892aad5f4d92b54549f6f43030ab46891b3ac
parente8e962044c6c041f1dccd34bd2467b3699df951a
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373301 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
test/CodeGen/WebAssembly/cfg-stackify-eh.ll