[compiler-rt] [mlir] [libunwind] [llvm] [flang] [lldb] [clang-tools-extra] [clang] [lld] [openmp] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 02:28:09 PST 2024
================
@@ -1624,6 +1632,15 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
} else {
DidChange = true;
PMBB->ReplaceUsesOfBlockWith(MBB, CurTBB);
+ // Add rest successors of MBB to successors of CurTBB. Those
+ // successors are not directly reachable via MBB, so it should be
+ // landing-pad.
+ for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE;
+ ++SI)
+ if (*SI != CurTBB && !CurTBB->isSuccessor(*SI)) {
+ assert((*SI)->isEHPad() && "Bad CFG");
+ CurTBB->copySuccessor(MBB, SI);
----------------
HaohaiWen wrote:
bb.6 is CurTBB so it will be skipped.
using pred_iterator = std::vector< MachineBasicBlock * >::iterator
Dereference pred_iterator get MachineBasicBlock *.
https://github.com/llvm/llvm-project/pull/77608
More information about the llvm-commits
mailing list