[llvm] Redesign Straight-Line Strength Reduction (SLSR) (PR #162930)

Drew Kersnar via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 11:09:40 PDT 2025


================
@@ -142,15 +160,23 @@ class StraightLineStrengthReduce {
       GEP,     // &B[..][i * S][..]
     };
 
+    enum DKind {
+      InvalidDelta, // reserved for the default constructor
+      IndexDelta,   // Delta is a constant from Index
+      BaseDelta,    // Delta is a constant or variable from Base
+      StrideDelta,  // Delta is a constant or variable from Stride
+    };
+
     Candidate() = default;
     Candidate(Kind CT, const SCEV *B, ConstantInt *Idx, Value *S,
-              Instruction *I)
-        : CandidateKind(CT), Base(B), Index(Idx), Stride(S), Ins(I) {}
+              Instruction *I, const SCEV *StrideSCEV)
+        : CandidateKind(CT), Base(B), Index(Idx), Stride(S), Ins(I),
+          StrideSCEV(StrideSCEV) {}
 
     Kind CandidateKind = Invalid;
 
     const SCEV *Base = nullptr;
----------------
dakersnar wrote:

Nit: should we name this BaseSCEV to match StrideSCEV?

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


More information about the llvm-commits mailing list