[PATCH] D59739: [WebAssembly] Fix bugs in BLOCK/TRY placement
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 23 12:26:28 PDT 2019
aheejin created this revision.
aheejin added reviewers: dschuff, sunfish.
Herald added subscribers: llvm-commits, jgravelle-google, sbc100.
Herald added a project: LLVM.
aheejin edited the summary of this revision.
aheejin edited the summary of this revision.
Before we placed all TRY/END_TRY markers before placing BLOCK/END_BLOCK
markers. This couldn't handle this case:
bb0:
br bb2
bb1: // nearest common dominator of bb3 and bb4
...
bb2:
br_if ... bb3
br bb4
bb3:
call @foo // unwinds to ehpad
bb4:
call @bar // unwinds to ehpad
ehpad:
catch
...
When we placed TRY markers, we placed it in bb1 because it is the
nearest common dominator of bb3 and bb4. But because bb0 jumps to bb2,
when we placed block markers, we ended up with interleaved scopes like
block
try
end_block
catch
end_try
which was not correct.
This patch fixes the bug by placing BLOCK and TRY markers in one pass
while iterating BBs in a function. This also adds some more routines to
`placeTryMarkers`, because we now have to assume that there can be
previously placed BLOCK and END_BLOCK.
Repository:
rL LLVM
https://reviews.llvm.org/D59739
Files:
lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
test/CodeGen/WebAssembly/cfg-stackify-eh.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59739.192011.patch
Type: text/x-patch
Size: 9947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190323/3b9e74ab/attachment.bin>
More information about the llvm-commits
mailing list