[llvm] Branch folding: Do not use both TII::analyzeBranch and MBB::isSuccessor (PR #104240)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 12:06:37 PDT 2024


================
@@ -1422,8 +1422,7 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
     // This has to check PrevBB->succ_size() because EH edges are ignored by
     // analyzeBranch.
     if (PriorCond.empty() && !PriorTBB && MBB->pred_size() == 1 &&
-        PrevBB.succ_size() == 1 && PrevBB.isSuccessor(MBB) &&
-        !MBB->hasAddressTaken() && !MBB->isEHPad()) {
----------------
v01dXYZ wrote:

I remove `PrevBB.isSuccessor(MBB)` as it is redundant with `!PriorTBB` (no branch at the end of block). I hesitate about `MBB->isEHPad()`.

https://github.com/llvm/llvm-project/pull/104240


More information about the llvm-commits mailing list