[llvm] [AArch64] ConditionOptimizer: replace intra-block scan with map-based algorithm (PR #190455)

Nashe Mncube via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 03:55:34 PDT 2026


================
@@ -511,9 +514,31 @@ bool AArch64ConditionOptimizerImpl::tryOptimizePair(CmpCondPair &First,
   return false;
 }
 
-// This function transforms two CMP+CSINC pairs within the same basic block
-// when both conditions are the same (GT/GT or LT/LT) and immediates differ
-// by 1.
+bool AArch64ConditionOptimizerImpl::commitPendingPair(
+    std::optional<CmpCondPair> &PendingPair,
+    DenseMap<Register, CmpCondPair> &PairsByReg) {
+  if (!PendingPair)
+    return false;
+
+  Register Reg = PendingPair->CmpMI->getOperand(1).getReg();
----------------
nasherm wrote:

Do we need to check if the `MachineOperand` type is a register here? Or is it always guranteed?

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


More information about the llvm-commits mailing list