[llvm] [BranchFolding] Refactor AreConditionalsEqual to Helper (PR #211270)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 10:53:53 PDT 2026


================
@@ -1391,6 +1391,15 @@ static void salvageDebugInfoFromEmptyBlock(const TargetInstrInfo *TII,
       copyDebugInfoToPredecessor(TII, MBB, *PredBB);
 }
 
+static bool AreConditionalsEqual(ArrayRef<MachineOperand> CurCond,
+                                 ArrayRef<MachineOperand> PriorCond) {
+  return CurCond.size() > 0 &&
----------------
arsenm wrote:

If this is known to be conditional branch, then can't you assume CurCond isn't empty?

```suggestion
  return !CurCond.empty() &&
```

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


More information about the llvm-commits mailing list