@@ -573,10 +573,6 @@ class InnerLoopVectorizer {
573
573
// / Fix the non-induction PHIs in \p Plan.
574
574
void fixNonInductionPHIs (VPlan &Plan, VPTransformState &State);
575
575
576
- // / Returns true if the reordering of FP operations is not allowed, but we are
577
- // / able to vectorize with strict in-order reductions for the given RdxDesc.
578
- bool useOrderedReductions (const RecurrenceDescriptor &RdxDesc);
579
-
580
576
// / Create a new phi node for the induction variable \p OrigPhi to resume
581
577
// / iteration count in the scalar epilogue, from where the vectorized loop
582
578
// / left off. \p Step is the SCEV-expanded induction step to use. In cases
@@ -3714,11 +3710,6 @@ void InnerLoopVectorizer::fixNonInductionPHIs(VPlan &Plan,
3714
3710
}
3715
3711
}
3716
3712
3717
- bool InnerLoopVectorizer::useOrderedReductions (
3718
- const RecurrenceDescriptor &RdxDesc) {
3719
- return Cost->useOrderedReductions (RdxDesc);
3720
- }
3721
-
3722
3713
void LoopVectorizationCostModel::collectLoopScalars (ElementCount VF) {
3723
3714
// We should not collect Scalars more than once per VF. Right now, this
3724
3715
// function is called from collectUniformsAndScalars(), which already does
@@ -9056,8 +9047,9 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
9056
9047
if (CM.blockNeedsPredicationForAnyReason (BB))
9057
9048
CondOp = RecipeBuilder.getBlockInMask (BB);
9058
9049
9059
- VPReductionRecipe *RedRecipe = new VPReductionRecipe (
9060
- RdxDesc, CurrentLinkI, PreviousLink, VecOp, CondOp);
9050
+ VPReductionRecipe *RedRecipe =
9051
+ new VPReductionRecipe (RdxDesc, CurrentLinkI, PreviousLink, VecOp,
9052
+ CondOp, CM.useOrderedReductions (RdxDesc));
9061
9053
// Append the recipe to the end of the VPBasicBlock because we need to
9062
9054
// ensure that it comes after all of it's inputs, including CondOp.
9063
9055
// Note that this transformation may leave over dead recipes (including
@@ -9307,57 +9299,6 @@ void VPInterleaveRecipe::execute(VPTransformState &State) {
9307
9299
NeedsMaskForGaps);
9308
9300
}
9309
9301
9310
- void VPReductionRecipe::execute (VPTransformState &State) {
9311
- assert (!State.Instance && " Reduction being replicated." );
9312
- Value *PrevInChain = State.get (getChainOp (), 0 , /* IsScalar*/ true );
9313
- RecurKind Kind = RdxDesc.getRecurrenceKind ();
9314
- bool IsOrdered = State.ILV ->useOrderedReductions (RdxDesc);
9315
- // Propagate the fast-math flags carried by the underlying instruction.
9316
- IRBuilderBase::FastMathFlagGuard FMFGuard (State.Builder );
9317
- State.Builder .setFastMathFlags (RdxDesc.getFastMathFlags ());
9318
- for (unsigned Part = 0 ; Part < State.UF ; ++Part) {
9319
- Value *NewVecOp = State.get (getVecOp (), Part);
9320
- if (VPValue *Cond = getCondOp ()) {
9321
- Value *NewCond = State.get (Cond, Part, State.VF .isScalar ());
9322
- VectorType *VecTy = dyn_cast<VectorType>(NewVecOp->getType ());
9323
- Type *ElementTy = VecTy ? VecTy->getElementType () : NewVecOp->getType ();
9324
- Value *Iden = RdxDesc.getRecurrenceIdentity (Kind, ElementTy,
9325
- RdxDesc.getFastMathFlags ());
9326
- if (State.VF .isVector ()) {
9327
- Iden =
9328
- State.Builder .CreateVectorSplat (VecTy->getElementCount (), Iden);
9329
- }
9330
-
9331
- Value *Select = State.Builder .CreateSelect (NewCond, NewVecOp, Iden);
9332
- NewVecOp = Select;
9333
- }
9334
- Value *NewRed;
9335
- Value *NextInChain;
9336
- if (IsOrdered) {
9337
- if (State.VF .isVector ())
9338
- NewRed = createOrderedReduction (State.Builder , RdxDesc, NewVecOp,
9339
- PrevInChain);
9340
- else
9341
- NewRed = State.Builder .CreateBinOp (
9342
- (Instruction::BinaryOps)RdxDesc.getOpcode (Kind), PrevInChain,
9343
- NewVecOp);
9344
- PrevInChain = NewRed;
9345
- } else {
9346
- PrevInChain = State.get (getChainOp (), Part, /* IsScalar*/ true );
9347
- NewRed = createTargetReduction (State.Builder , RdxDesc, NewVecOp);
9348
- }
9349
- if (RecurrenceDescriptor::isMinMaxRecurrenceKind (Kind)) {
9350
- NextInChain = createMinMaxOp (State.Builder , RdxDesc.getRecurrenceKind (),
9351
- NewRed, PrevInChain);
9352
- } else if (IsOrdered)
9353
- NextInChain = NewRed;
9354
- else
9355
- NextInChain = State.Builder .CreateBinOp (
9356
- (Instruction::BinaryOps)RdxDesc.getOpcode (Kind), NewRed, PrevInChain);
9357
- State.set (this , NextInChain, Part, /* IsScalar*/ true );
9358
- }
9359
- }
9360
-
9361
9302
void VPReplicateRecipe::execute (VPTransformState &State) {
9362
9303
Instruction *UI = getUnderlyingInstr ();
9363
9304
if (State.Instance ) { // Generate a single instance.
0 commit comments