[llvm] [VPlan] Narrow truncates of an induction plus a constant offset (PR #226035)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 13:54:33 PDT 2026


================
@@ -929,7 +932,26 @@ getOptimizableIVOf(VPValue *VPV, PredicatedScalarEvolution &PSE) {
     }
     llvm_unreachable("should have been covered by switch above");
   };
-  return IsWideIVInc() ? WideIV : nullptr;
+  if (!PostIncStart)
+    return IsWideIVInc() ? WideIV : nullptr;
+
+  // start + C + i * step stays affine for any constant C, including the step,
----------------
artagnon wrote:

```suggestion
  // (Start + C) * Step stays affine for any constant C, including the step,
```

The comment holds for any loop-invariant C? I think we're also unnecessarily restricting Start to be a constant here?

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


More information about the llvm-commits mailing list