@@ -691,7 +691,7 @@ RecurrenceDescriptor::isAnyOfPattern(Loop *Loop, PHINode *OrigPhi,
691
691
// reduction operations.
692
692
RecurrenceDescriptor::InstDesc
693
693
RecurrenceDescriptor::isFindLastIVPattern (PHINode *OrigPhi, Instruction *I,
694
- ScalarEvolution * SE) {
694
+ ScalarEvolution & SE) {
695
695
// Only match select with single use cmp condition.
696
696
// TODO: Only handle single use for now.
697
697
CmpInst::Predicate Pred;
@@ -710,22 +710,19 @@ RecurrenceDescriptor::isFindLastIVPattern(PHINode *OrigPhi, Instruction *I,
710
710
return InstDesc (false , I);
711
711
712
712
auto IsIncreasingLoopInduction = [&](Value *V) {
713
- if (!SE)
714
- return false ;
715
-
716
713
Type *Ty = V->getType ();
717
- if (!SE-> isSCEVable (Ty))
714
+ if (!SE. isSCEVable (Ty))
718
715
return false ;
719
716
720
- auto *AR = dyn_cast<SCEVAddRecExpr>(SE-> getSCEV (V));
717
+ auto *AR = dyn_cast<SCEVAddRecExpr>(SE. getSCEV (V));
721
718
if (!AR)
722
719
return false ;
723
720
724
- const SCEV *Step = AR->getStepRecurrence (* SE);
725
- if (!SE-> isKnownPositive (Step))
721
+ const SCEV *Step = AR->getStepRecurrence (SE);
722
+ if (!SE. isKnownPositive (Step))
726
723
return false ;
727
724
728
- const ConstantRange IVRange = SE-> getSignedRange (AR);
725
+ const ConstantRange IVRange = SE. getSignedRange (AR);
729
726
unsigned NumBits = Ty->getIntegerBitWidth ();
730
727
// Keep the minimum value of the recurrence type as the sentinel value.
731
728
// The maximum acceptable range for the increasing induction variable,
@@ -887,8 +884,8 @@ RecurrenceDescriptor::InstDesc RecurrenceDescriptor::isRecurrenceInstr(
887
884
if (Kind == RecurKind::FAdd || Kind == RecurKind::FMul ||
888
885
Kind == RecurKind::Add || Kind == RecurKind::Mul)
889
886
return isConditionalRdxPattern (Kind, I);
890
- if (isFindLastIVRecurrenceKind (Kind))
891
- return isFindLastIVPattern (OrigPhi, I, SE);
887
+ if (isFindLastIVRecurrenceKind (Kind) && SE )
888
+ return isFindLastIVPattern (OrigPhi, I, * SE);
892
889
[[fallthrough]];
893
890
case Instruction::FCmp:
894
891
case Instruction::ICmp:
0 commit comments