@@ -225,7 +225,7 @@ VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi() {
225
225
VPTransformState::VPTransformState (ElementCount VF, unsigned UF, LoopInfo *LI,
226
226
DominatorTree *DT, IRBuilderBase &Builder,
227
227
InnerLoopVectorizer *ILV, VPlan *Plan)
228
- : VF(VF), UF(UF), CFG(DT), LI(LI), Builder(Builder), ILV(ILV), Plan(Plan),
228
+ : VF(VF), CFG(DT), LI(LI), Builder(Builder), ILV(ILV), Plan(Plan),
229
229
LVer(nullptr ), TypeAnalysis(Plan->getCanonicalIV ()->getScalarType()) {}
230
230
231
231
Value *VPTransformState::get (VPValue *Def, const VPIteration &Instance) {
@@ -772,9 +772,6 @@ void VPRegionBlock::execute(VPTransformState *State) {
772
772
773
773
// Enter replicating mode.
774
774
State->Instance = VPIteration (0 , 0 );
775
-
776
- for (unsigned Part = 0 , UF = State->UF ; Part < UF; ++Part) {
777
- State->Instance ->Part = Part;
778
775
assert (!State->VF .isScalable () && " VF is assumed to be non scalable." );
779
776
for (unsigned Lane = 0 , VF = State->VF .getKnownMinValue (); Lane < VF;
780
777
++Lane) {
@@ -784,7 +781,6 @@ void VPRegionBlock::execute(VPTransformState *State) {
784
781
LLVM_DEBUG (dbgs () << " LV: VPBlock in RPO " << Block->getName () << ' \n ' );
785
782
Block->execute (State);
786
783
}
787
- }
788
784
}
789
785
790
786
// Exit replicating mode.
@@ -963,16 +959,15 @@ void VPlan::prepareToExecute(Value *TripCountV, Value *VectorTripCountV,
963
959
IRBuilder<> Builder (State.CFG .PrevBB ->getTerminator ());
964
960
// FIXME: Model VF * UF computation completely in VPlan.
965
961
assert (VFxUF.getNumUsers () && " VFxUF expected to always have users" );
962
+ unsigned UF = getUF ();
966
963
if (VF.getNumUsers ()) {
967
964
Value *RuntimeVF = getRuntimeVF (Builder, TCTy, State.VF );
968
965
VF.setUnderlyingValue (RuntimeVF);
969
966
VFxUF.setUnderlyingValue (
970
- State.UF > 1
971
- ? Builder.CreateMul (RuntimeVF, ConstantInt::get (TCTy, State.UF ))
972
- : RuntimeVF);
967
+ UF > 1 ? Builder.CreateMul (RuntimeVF, ConstantInt::get (TCTy, UF))
968
+ : RuntimeVF);
973
969
} else {
974
- VFxUF.setUnderlyingValue (
975
- createStepForVF (Builder, TCTy, State.VF , State.UF ));
970
+ VFxUF.setUnderlyingValue (createStepForVF (Builder, TCTy, State.VF , UF));
976
971
}
977
972
978
973
// When vectorizing the epilogue loop, the canonical induction start value
@@ -1019,10 +1014,6 @@ static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
1019
1014
// / Assumes a single pre-header basic-block was created for this. Introduce
1020
1015
// / additional basic-blocks as needed, and fill them all.
1021
1016
void VPlan::execute (VPTransformState *State) {
1022
- // Set UF to 1, as the unrollByUF VPlan transform already explicitly unrolled
1023
- // the VPlan.
1024
- // TODO: Remove State::UF and all uses.
1025
- State->UF = 1 ;
1026
1017
// Initialize CFG state.
1027
1018
State->CFG .PrevVPBB = nullptr ;
1028
1019
State->CFG .ExitBB = State->CFG .PrevBB ->getSingleSuccessor ();
@@ -1106,28 +1097,13 @@ void VPlan::execute(VPTransformState *State) {
1106
1097
}
1107
1098
1108
1099
auto *PhiR = cast<VPHeaderPHIRecipe>(&R);
1109
- // For canonical IV, first-order recurrences and in-order reduction phis,
1110
- // only a single part is generated, which provides the last part from the
1111
- // previous iteration. For non-ordered reductions all UF parts are
1112
- // generated.
1113
- bool SinglePartNeeded =
1114
- isa<VPCanonicalIVPHIRecipe>(PhiR) ||
1115
- isa<VPFirstOrderRecurrencePHIRecipe, VPEVLBasedIVPHIRecipe>(PhiR) ||
1116
- (isa<VPReductionPHIRecipe>(PhiR) &&
1117
- cast<VPReductionPHIRecipe>(PhiR)->isOrdered ());
1118
1100
bool NeedsScalar =
1119
1101
isa<VPCanonicalIVPHIRecipe, VPEVLBasedIVPHIRecipe>(PhiR) ||
1120
1102
(isa<VPReductionPHIRecipe>(PhiR) &&
1121
1103
cast<VPReductionPHIRecipe>(PhiR)->isInLoop ());
1122
- unsigned LastPartForNewPhi = SinglePartNeeded ? 1 : State->UF ;
1123
-
1124
- for (unsigned Part = 0 ; Part < LastPartForNewPhi; ++Part) {
1125
- Value *Phi = State->get (PhiR, Part, NeedsScalar);
1126
- Value *Val =
1127
- State->get (PhiR->getBackedgeValue (),
1128
- SinglePartNeeded ? State->UF - 1 : Part, NeedsScalar);
1129
- cast<PHINode>(Phi)->addIncoming (Val, VectorLatchBB);
1130
- }
1104
+ Value *Phi = State->get (PhiR, 0 , NeedsScalar);
1105
+ Value *Val = State->get (PhiR->getBackedgeValue (), 0 , NeedsScalar);
1106
+ cast<PHINode>(Phi)->addIncoming (Val, VectorLatchBB);
1131
1107
}
1132
1108
1133
1109
State->CFG .DTU .flush ();
0 commit comments