[llvm] [VPlan] Add FinalIVValue VPInstruction. (PR #175651)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 19 05:36:02 PST 2026


================
@@ -1008,8 +1009,9 @@ static VPValue *optimizeEarlyExitInductionUser(VPlan &Plan,
 static VPValue *optimizeLatchExitInductionUser(
     VPlan &Plan, VPTypeAnalysis &TypeInfo, VPBlockBase *PredVPBB, VPValue *Op,
     DenseMap<VPValue *, VPValue *> &EndValues, PredicatedScalarEvolution &PSE) {
-  VPValue *Incoming;
-  if (!match(Op, m_ExtractLastLaneOfLastPart(m_VPValue(Incoming))))
+  VPValue *Incoming = Op;
+  if (!match(Op, m_CombineOr(m_FinalIVValue(m_VPValue(), m_VPValue()),
+                             m_ExtractLastLaneOfLastPart(m_VPValue(Incoming)))))
     return nullptr;
 
   auto *WideIV = getOptimizableIVOf(Incoming, PSE);
----------------
fhahn wrote:

Currently widened IVs can be truncated, but only if the truncate has the induction phi directly as operand currently. If the increment is truncated, we will use the widened IV still.

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


More information about the llvm-commits mailing list