RecurrenceDescriptor::InstDesc
RecurrenceDescriptor::isRecurrenceInstr(Instruction *I, RecurKind Kind,
InstDesc &Prev, FastMathFlags FMF) {
- Instruction *UAI = Prev.getUnsafeAlgebraInst();
- if (!UAI && isa<FPMathOperator>(I) && !I->hasAllowReassoc())
- UAI = I; // Found an unsafe (unvectorizable) algebra instruction.
-
switch (I->getOpcode()) {
default:
return InstDesc(false, I);
return InstDesc(Kind == RecurKind::Xor, I);
case Instruction::FDiv:
case Instruction::FMul:
- return InstDesc(Kind == RecurKind::FMul, I, UAI);
+ return InstDesc(Kind == RecurKind::FMul, I,
+ I->hasAllowReassoc() ? nullptr : I);
case Instruction::FSub:
case Instruction::FAdd:
- return InstDesc(Kind == RecurKind::FAdd, I, UAI);
+ return InstDesc(Kind == RecurKind::FAdd, I,
+ I->hasAllowReassoc() ? nullptr : I);
case Instruction::Select:
if (Kind == RecurKind::FAdd || Kind == RecurKind::FMul)
return isConditionalRdxPattern(Kind, I);
case Instruction::FCmp:
case Instruction::ICmp:
if (isIntMinMaxRecurrenceKind(Kind) ||
- (FMF.noNaNs() && FMF.noSignedZeros() &&
- isFPMinMaxRecurrenceKind(Kind)))
+ (FMF.noNaNs() && FMF.noSignedZeros() && isFPMinMaxRecurrenceKind(Kind)))
return isMinMaxSelectCmpPattern(I, Prev);
return InstDesc(false, I);
}