[llvm] [WebAssembly] Misc. fixes in CFGStackify (PR #107182)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 22:31:08 PDT 2024
================
@@ -1231,22 +1225,24 @@ bool WebAssemblyCFGStackify::fixCallUnwindMismatches(MachineFunction &MF) {
std::tie(RangeBegin, RangeEnd) = Range;
auto *MBB = RangeBegin->getParent();
- // If this BB has an EH pad successor, i.e., ends with an 'invoke', now we
- // are going to wrap the invoke with try-delegate, making the 'delegate'
- // BB the new successor instead, so remove the EH pad succesor here. The
- // BB may not have an EH pad successor if calls in this BB throw to the
- // caller.
- MachineBasicBlock *EHPad = nullptr;
- for (auto *Succ : MBB->successors()) {
- if (Succ->isEHPad()) {
- EHPad = Succ;
- break;
+ // If this BB has an EH pad successor, i.e., ends with an 'invoke', and if
+ // the current range contains the invoke, now we are going to wrap the
+ // invoke with try-delegate, making the 'delegate' BB the new successor
+ // instead, so remove the EH pad succesor here. The BB may not have an EH
+ // pad successor if calls in this BB throw to the caller.
+ if (UnwindDest != getFakeCallerBlock(MF)) {
----------------
aheejin wrote:
This is just to make the code clearer. Even without this `if`, because if this unwinds to the caller, there will be no EH pad successor in the loop below so the result will be the same, but I think this is more readable.
https://github.com/llvm/llvm-project/pull/107182
More information about the llvm-commits
mailing list