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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 00:32:45 PDT 2026


================
@@ -929,7 +932,25 @@ 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) + IV * Step stays affine for any constant C, including the
+  // step, so it can be folded into the start value.
----------------
artagnon wrote:

```suggestion
  // (Start + C) + IV * Step stays affine for any constant C, including the
  // Step, so it can be folded into the Start value.
  // It would not be profitable to look for a non-constant Start or C, as it would necessitate introducing an extra add or sub instruction.
```

Kindly capitalize Start and Step, to match the variables?

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


More information about the llvm-commits mailing list