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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 15:13:02 PST 2026


================
@@ -5751,16 +5793,26 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
         BackedgeVal,
         match_fn(m_VPInstruction<VPInstruction::ComputeReductionResult>())));
 
+    VPValue *NewBackedgeVal = CondSelect;
+    // If IV is an expression, create a new select that tracks the underlying
+    // IV directly and update the backedge value.
+    if (ExpressionIV) {
+      auto *SelectR = BackedgeVal->getDefiningRecipe();
----------------
fhahn wrote:

It should use the recipe of the actual value select (CondSelect), updated, thanks

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


More information about the llvm-commits mailing list