Page MenuHomePhabricator

[WebAssembly] Unstackify regs after fixing unwinding mismatches
ClosedPublic

Authored by aheejin on Sep 30 2019, 6:40 AM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

aheejin created this revision.Sep 30 2019, 6:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 30 2019, 6:40 AM
dschuff accepted this revision.Sep 30 2019, 3:46 PM
dschuff added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
699 ↗(On Diff #222411)

It might be more convenient/concise to just pass in MRI/MFI from the caller. (Hopefully the resulting code would be the same, but I guess in an unoptimized build, maybe faster too).

This revision is now accepted and ready to land.Sep 30 2019, 3:46 PM
aheejin updated this revision to Diff 222547.Sep 30 2019, 11:18 PM
aheejin marked an inline comment as done.
  • Address comments
This revision was automatically updated to reflect the committed changes.