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