diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-03-26 17:29:55 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2019-03-26 17:29:55 +0000 |
commit | 222718fdd20545e90f46e93d76b58eeb3dd63773 (patch) | |
tree | d0f3771bfe04c551f0f2655a749a8cf30ad7b9e6 /llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp | |
parent | 44a5a4b10704b336700a94403103faaba6fa9729 (diff) | |
download | llvm-222718fdd20545e90f46e93d76b58eeb3dd63773.zip llvm-222718fdd20545e90f46e93d76b58eeb3dd63773.tar.gz llvm-222718fdd20545e90f46e93d76b58eeb3dd63773.tar.bz2 |
[WebAssembly] Fix a bug when mixing TRY/LOOP markers
Summary:
When TRY and LOOP markers are in the same BB and END_TRY and END_LOOP
markers are in the same BB, END_TRY should be _before_ END_LOOP, because
LOOP is always before TRY if they are in the same BB. (TRY is placed in
the latest possible position, whereas LOOP is in the earliest possible
position.)
Reviewers: dschuff
Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59751
llvm-svn: 357008
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp index b1a4795..7a7838a 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp @@ -579,7 +579,9 @@ void WebAssemblyCFGStackify::placeTryMarker(MachineBasicBlock &MBB) { // the END_TRY marker should go after that. Otherwise, the whole try-catch // is contained within this loop, so the END_TRY should go before that. if (MI.getOpcode() == WebAssembly::END_LOOP) { - if (EndToBegin[&MI]->getParent()->getNumber() >= Header->getNumber()) + // For a LOOP to be after TRY, LOOP's BB should be after TRY's BB; if they + // are in the same BB, LOOP is always before TRY. + if (EndToBegin[&MI]->getParent()->getNumber() > Header->getNumber()) BeforeSet.insert(&MI); #ifndef NDEBUG else |