[llvm] [VPlan] Optimize FindLast of (binop %IV, live-in) by sinking. (PR #183911)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 29 12:16:49 PDT 2026


================
@@ -5742,11 +5755,15 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
                                     m_VPValue(FalseVal))))
       continue;
 
-    // The non-phi operand of the select is the IV.
+    // The non-phi operand of the select is the IV or an expression of IV.
     assert(is_contained(CondSelect->getDefiningRecipe()->operands(), PhiR));
-    VPValue *IV = TrueVal == PhiR ? FalseVal : TrueVal;
+    VPValue *ExprOfIV = TrueVal == PhiR ? FalseVal : TrueVal;
 
-    const SCEV *IVSCEV = vputils::getSCEVExprForVPValue(IV, PSE, &L);
+    // Check if IV is a simple expression of a widened IV. If so, we can track
+    // the underlying IV and sink the expression.
----------------
fhahn wrote:

updated thanks

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


More information about the llvm-commits mailing list