@@ -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 return true ;
5554 }
5655 return false ;
@@ -651,8 +650,7 @@ RecurrenceDescriptor::isAnyOfPattern(Loop *Loop, PHINode *OrigPhi,
651650 if (!Loop->isLoopInvariant (NonPhi))
652651 return InstDesc (false , I);
653652
654- return InstDesc (I, isa<ICmpInst>(I->getOperand (0 )) ? RecurKind::IAnyOf
655- : RecurKind::FAnyOf);
653+ return InstDesc (I, RecurKind::AnyOf);
656654}
657655
658656RecurrenceDescriptor::InstDesc
@@ -884,7 +882,7 @@ bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
884882 LLVM_DEBUG (dbgs () << " Found a UMIN reduction PHI." << *Phi << " \n " );
885883 return true ;
886884 }
887- if (AddReductionVar (Phi, RecurKind::IAnyOf , TheLoop, FMF, RedDes, DB, AC, DT,
885+ if (AddReductionVar (Phi, RecurKind::AnyOf , TheLoop, FMF, RedDes, DB, AC, DT,
888886 SE)) {
889887 LLVM_DEBUG (dbgs () << " Found an conditional select reduction PHI." << *Phi
890888 << " \n " );
@@ -1017,7 +1015,7 @@ bool RecurrenceDescriptor::isFixedOrderRecurrence(PHINode *Phi, Loop *TheLoop,
10171015 return true ;
10181016}
10191017
1020- unsigned RecurrenceDescriptor::getOpcode (RecurKind Kind) {
1018+ unsigned RecurrenceDescriptor::getOpcode (RecurKind Kind, Type *Ty ) {
10211019 switch (Kind) {
10221020 case RecurKind::Add:
10231021 return Instruction::Add;
@@ -1038,14 +1036,14 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
10381036 case RecurKind::SMin:
10391037 case RecurKind::UMax:
10401038 case RecurKind::UMin:
1041- case RecurKind::IAnyOf:
10421039 return Instruction::ICmp;
10431040 case RecurKind::FMax:
10441041 case RecurKind::FMin:
10451042 case RecurKind::FMaximum:
10461043 case RecurKind::FMinimum:
1047- case RecurKind::FAnyOf:
10481044 return Instruction::FCmp;
1045+ case RecurKind::AnyOf:
1046+ return Ty->isIntegerTy () ? Instruction::ICmp : Instruction::FCmp;
10491047 default :
10501048 llvm_unreachable (" Unknown recurrence operation" );
10511049 }
@@ -1054,7 +1052,7 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
10541052SmallVector<Instruction *, 4 >
10551053RecurrenceDescriptor::getReductionOpChain (PHINode *Phi, Loop *L) const {
10561054 SmallVector<Instruction *, 4 > ReductionOperations;
1057- unsigned RedOp = getOpcode (Kind );
1055+ unsigned RedOp = getOpcode ();
10581056
10591057 // Search down from the Phi to the LoopExitInstr, looking for instructions
10601058 // with a single user of the correct type for the reduction.
0 commit comments