@@ -49,8 +49,7 @@ bool RecurrenceDescriptor::isIntegerRecurrenceKind(RecurKind Kind) {
4949 case RecurKind::SMin:
5050 case RecurKind::UMax:
5151 case RecurKind::UMin:
52- case RecurKind::IAnyOf:
53- case RecurKind::FAnyOf:
52+ case RecurKind::AnyOf:
5453 case RecurKind::FindLastIV:
5554 return true ;
5655 }
@@ -416,11 +415,11 @@ bool RecurrenceDescriptor::AddReductionVar(
416415 if (IsAPhi && Cur != Phi && !areAllUsesIn (Cur, VisitedInsts))
417416 return false ;
418417
419- if ((isIntMinMaxRecurrenceKind (Kind) || Kind == RecurKind::IAnyOf) &&
420- (isa<ICmpInst>(Cur) || isa<SelectInst>(Cur)))
418+ if (isIntMinMaxRecurrenceKind (Kind) && (isa<ICmpInst>(Cur) || IsASelect))
421419 ++NumCmpSelectPatternInst;
422- if ((isFPMinMaxRecurrenceKind (Kind) || Kind == RecurKind::FAnyOf) &&
423- (isa<FCmpInst>(Cur) || isa<SelectInst>(Cur)))
420+ if (isFPMinMaxRecurrenceKind (Kind) && (isa<FCmpInst>(Cur) || IsASelect))
421+ ++NumCmpSelectPatternInst;
422+ if (isAnyOfRecurrenceKind (Kind) && IsASelect)
424423 ++NumCmpSelectPatternInst;
425424
426425 // Check whether we found a reduction operator.
@@ -653,8 +652,7 @@ RecurrenceDescriptor::isAnyOfPattern(Loop *Loop, PHINode *OrigPhi,
653652 if (!Loop->isLoopInvariant (NonPhi))
654653 return InstDesc (false , I);
655654
656- return InstDesc (I, isa<ICmpInst>(I->getOperand (0 )) ? RecurKind::IAnyOf
657- : RecurKind::FAnyOf);
655+ return InstDesc (I, RecurKind::AnyOf);
658656}
659657
660658// We are looking for loops that do something like this:
@@ -981,10 +979,10 @@ bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
981979 LLVM_DEBUG (dbgs () << " Found a UMIN reduction PHI." << *Phi << " \n " );
982980 return true ;
983981 }
984- if (AddReductionVar (Phi, RecurKind::IAnyOf , TheLoop, FMF, RedDes, DB, AC, DT,
982+ if (AddReductionVar (Phi, RecurKind::AnyOf , TheLoop, FMF, RedDes, DB, AC, DT,
985983 SE)) {
986- LLVM_DEBUG (dbgs () << " Found an integer conditional select reduction PHI."
987- << *Phi << " \n " );
984+ LLVM_DEBUG (dbgs () << " Found a conditional select reduction PHI." << *Phi
985+ << " \n " );
988986 return true ;
989987 }
990988 if (AddReductionVar (Phi, RecurKind::FindLastIV, TheLoop, FMF, RedDes, DB, AC,
@@ -1012,12 +1010,6 @@ bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
10121010 LLVM_DEBUG (dbgs () << " Found a float MIN reduction PHI." << *Phi << " \n " );
10131011 return true ;
10141012 }
1015- if (AddReductionVar (Phi, RecurKind::FAnyOf, TheLoop, FMF, RedDes, DB, AC, DT,
1016- SE)) {
1017- LLVM_DEBUG (dbgs () << " Found a float conditional select reduction PHI."
1018- << " PHI." << *Phi << " \n " );
1019- return true ;
1020- }
10211013 if (AddReductionVar (Phi, RecurKind::FMulAdd, TheLoop, FMF, RedDes, DB, AC, DT,
10221014 SE)) {
10231015 LLVM_DEBUG (dbgs () << " Found an FMulAdd reduction PHI." << *Phi << " \n " );
@@ -1144,8 +1136,7 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
11441136 return Instruction::Add;
11451137 case RecurKind::Mul:
11461138 return Instruction::Mul;
1147- case RecurKind::IAnyOf:
1148- case RecurKind::FAnyOf:
1139+ case RecurKind::AnyOf:
11491140 case RecurKind::FindLastIV:
11501141 case RecurKind::Or:
11511142 return Instruction::Or;
0 commit comments