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

Vedant Paranjape via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 09:55:44 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,
----------------
VedantParanjape wrote:

We can't constant-fold if Start isn't a constant. So is emitting an extra add/sub instruction even profitable?

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


More information about the llvm-commits mailing list