Skip to content

Commit 1cdd536

Browse files
committed
[SCEVPM] Rename to AffineAddRec; avoid footguns
1 parent 1601aff commit 1cdd536

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,9 @@ m_scev_UDiv(const Op0_t &Op0, const Op1_t &Op1) {
196196
return m_scev_Binary<SCEVUDivExpr>(Op0, Op1);
197197
}
198198

199-
// Matches affine AddRecs.
200199
template <typename Op0_t, typename Op1_t>
201200
inline SCEVBinaryExpr_match<SCEVAddRecExpr, Op0_t, Op1_t>
202-
m_scev_AddRec(const Op0_t &Op0, const Op1_t &Op1) {
201+
m_scev_AffineAddRec(const Op0_t &Op0, const Op1_t &Op1) {
203202
return m_scev_Binary<SCEVAddRecExpr>(Op0, Op1);
204203
}
205204
} // namespace SCEVPatternMatch

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12481,8 +12481,8 @@ static bool IsKnownPredicateViaAddRecStart(ScalarEvolution &SE,
1248112481
return false;
1248212482

1248312483
const SCEV *LStart, *RStart, *Step;
12484-
if (!match(LHS, m_scev_AddRec(m_SCEV(LStart), m_SCEV(Step))) ||
12485-
!match(RHS, m_scev_AddRec(m_SCEV(RStart), m_scev_Specific(Step))))
12484+
if (!match(LHS, m_scev_AffineAddRec(m_SCEV(LStart), m_SCEV(Step))) ||
12485+
!match(RHS, m_scev_AffineAddRec(m_SCEV(RStart), m_scev_Specific(Step))))
1248612486
return false;
1248712487
const SCEVAddRecExpr *LAR = cast<SCEVAddRecExpr>(LHS);
1248812488
const SCEVAddRecExpr *RAR = cast<SCEVAddRecExpr>(RHS);

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static void DoInitialMatch(const SCEV *S, Loop *L,
558558

559559
// Look at addrec operands.
560560
const SCEV *Start, *Step;
561-
if (match(S, m_scev_AddRec(m_SCEV(Start), m_SCEV(Step))) &&
561+
if (match(S, m_scev_AffineAddRec(m_SCEV(Start), m_SCEV(Step))) &&
562562
!Start->isZero()) {
563563
DoInitialMatch(Start, L, Good, Bad, SE);
564564
DoInitialMatch(SE.getAddRecExpr(SE.getConstant(S->getType(), 0), Step,
@@ -1440,7 +1440,7 @@ void Cost::RateRegister(const Formula &F, const SCEV *Reg,
14401440
TTI->isIndexedStoreLegal(TTI->MIM_PostInc, AR->getType())) {
14411441
const SCEV *Start;
14421442
const SCEVConstant *Step;
1443-
if (match(AR, m_scev_AddRec(m_SCEV(Start), m_SCEVConstant(Step))))
1443+
if (match(AR, m_scev_AffineAddRec(m_SCEV(Start), m_SCEVConstant(Step))))
14441444
// If the step size matches the base offset, we could use pre-indexed
14451445
// addressing.
14461446
if ((AMK == TTI::AMK_PreIndexed && F.BaseOffset.isFixed() &&
@@ -2540,7 +2540,8 @@ ICmpInst *LSRInstance::OptimizeMax(ICmpInst *Cond, IVStrideUse* &CondUse) {
25402540
// Check the relevant induction variable for conformance to
25412541
// the pattern.
25422542
const SCEV *IV = SE.getSCEV(Cond->getOperand(0));
2543-
if (!match(IV, m_scev_AddRec(m_scev_SpecificInt(1), m_scev_SpecificInt(1))))
2543+
if (!match(IV,
2544+
m_scev_AffineAddRec(m_scev_SpecificInt(1), m_scev_SpecificInt(1))))
25442545
return Cond;
25452546

25462547
assert(cast<SCEVAddRecExpr>(IV)->getLoop() == L &&
@@ -3843,7 +3844,7 @@ static const SCEV *CollectSubexprs(const SCEV *S, const SCEVConstant *C,
38433844
return nullptr;
38443845
}
38453846
const SCEV *Start, *Step;
3846-
if (match(S, m_scev_AddRec(m_SCEV(Start), m_SCEV(Step)))) {
3847+
if (match(S, m_scev_AffineAddRec(m_SCEV(Start), m_SCEV(Step)))) {
38473848
// Split a non-zero base out of an addrec.
38483849
if (Start->isZero())
38493850
return S;
@@ -3890,7 +3891,7 @@ static bool mayUsePostIncMode(const TargetTransformInfo &TTI,
38903891
!LU.AccessTy.getType()->isIntOrIntVectorTy())
38913892
return false;
38923893
const SCEV *Start;
3893-
if (!match(S, m_scev_AddRec(m_SCEV(Start), m_SCEVConstant())))
3894+
if (!match(S, m_scev_AffineAddRec(m_SCEV(Start), m_SCEVConstant())))
38943895
return false;
38953896
// Check if a post-indexed load/store can be used.
38963897
if (TTI.isIndexedLoadLegal(TTI.MIM_PostInc, S->getType()) ||
@@ -4155,7 +4156,7 @@ void LSRInstance::GenerateConstantOffsetsImpl(
41554156
// instructions for pointer updating.
41564157
if (AMK == TTI::AMK_PreIndexed && LU.Kind == LSRUse::Address) {
41574158
const APInt *StepInt;
4158-
if (match(G, m_scev_AddRec(m_SCEV(), m_scev_APInt(StepInt)))) {
4159+
if (match(G, m_scev_AffineAddRec(m_SCEV(), m_scev_APInt(StepInt)))) {
41594160
int64_t Step = StepInt->isNegative() ? StepInt->getSExtValue()
41604161
: StepInt->getZExtValue();
41614162

0 commit comments

Comments
 (0)