Skip to content

Commit a0d368d

Browse files
committed
[IndVars] Use m_scev_AffineAddRec
1 parent 284b154 commit a0d368d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,11 +807,9 @@ static bool isLoopCounter(PHINode* Phi, Loop *L,
807807
if (!SE->isSCEVable(Phi->getType()))
808808
return false;
809809

810-
const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
811-
if (!AR || AR->getLoop() != L || !AR->isAffine())
812-
return false;
813-
814-
if (!match(AR->getStepRecurrence(*SE), m_scev_SpecificInt(1)))
810+
const SCEV *S = SE->getSCEV(Phi);
811+
if (!match(S, m_scev_AffineAddRec(m_SCEV(), m_scev_One())) ||
812+
cast<SCEVAddRecExpr>(S)->getLoop() != L)
815813
return false;
816814

817815
int LatchIdx = Phi->getBasicBlockIndex(L->getLoopLatch());

0 commit comments

Comments
 (0)