[llvm] [LV] Use SCEV to compute final value of complex induction variables (PR #195059)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 02:45:03 PDT 2026


================
@@ -1098,54 +1098,75 @@ static VPValue *tryToComputeEndValueForInduction(VPWidenInductionRecipe *WideIV,
 
 /// Attempts to optimize the induction variable exit values for users in the
 /// exit block coming from the latch in the original scalar loop.
-static VPValue *
-optimizeLatchExitInductionUser(VPlan &Plan, VPValue *Op,
-                               DenseMap<VPValue *, VPValue *> &EndValues,
-                               PredicatedScalarEvolution &PSE) {
+static VPValue *optimizeLatchExitInductionUser(
+    VPlan &Plan, VPValue *Op, DenseMap<VPValue *, VPValue *> &EndValues,
+    PredicatedScalarEvolution &PSE, VPValue *ResumeTC, const Loop *L) {
   VPValue *Incoming;
   if (!match(Op, m_ExtractLastLaneOfLastPart(m_VPValue(Incoming))))
     return nullptr;
 
-  VPWidenInductionRecipe *WideIV = getOptimizableIVOf(Incoming, PSE);
-  if (!WideIV)
-    return nullptr;
+  auto *ExtractR = cast<VPInstruction>(Op);
----------------
artagnon wrote:

```suggestion
  VPBuilder Builder(Op);
```

ExtractR and the cast is unnecessary?

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


More information about the llvm-commits mailing list