Skip to content

Commit 7f1ef83

Browse files
committed
!fixup fix formatting
1 parent ab709d3 commit 7f1ef83

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,38 +1013,38 @@ void VPlan::execute(VPTransformState *State) {
10131013
cast<VPBasicBlock>(Header->getPredecessors()[1]);
10141014
BasicBlock *VectorLatchBB = State->CFG.VPBB2IRBB[LatchVPBB];
10151015

1016-
if (isa<VPWidenInductionRecipe>(&R)) {
1017-
PHINode *Phi = nullptr;
1018-
if (isa<VPWidenIntOrFpInductionRecipe>(&R)) {
1019-
Phi = cast<PHINode>(State->get(R.getVPSingleValue()));
1020-
} else {
1021-
auto *WidenPhi = cast<VPWidenPointerInductionRecipe>(&R);
1022-
assert(!WidenPhi->onlyScalarsGenerated(State->VF.isScalable()) &&
1023-
"recipe generating only scalars should have been replaced");
1024-
auto *GEP = cast<GetElementPtrInst>(State->get(WidenPhi));
1025-
Phi = cast<PHINode>(GEP->getPointerOperand());
1016+
if (isa<VPWidenInductionRecipe>(&R)) {
1017+
PHINode *Phi = nullptr;
1018+
if (isa<VPWidenIntOrFpInductionRecipe>(&R)) {
1019+
Phi = cast<PHINode>(State->get(R.getVPSingleValue()));
1020+
} else {
1021+
auto *WidenPhi = cast<VPWidenPointerInductionRecipe>(&R);
1022+
assert(!WidenPhi->onlyScalarsGenerated(State->VF.isScalable()) &&
1023+
"recipe generating only scalars should have been replaced");
1024+
auto *GEP = cast<GetElementPtrInst>(State->get(WidenPhi));
1025+
Phi = cast<PHINode>(GEP->getPointerOperand());
1026+
}
1027+
1028+
Phi->setIncomingBlock(1, VectorLatchBB);
1029+
1030+
// Move the last step to the end of the latch block. This ensures
1031+
// consistent placement of all induction updates.
1032+
Instruction *Inc = cast<Instruction>(Phi->getIncomingValue(1));
1033+
Inc->moveBefore(VectorLatchBB->getTerminator()->getPrevNode());
1034+
1035+
// Use the steps for the last part as backedge value for the induction.
1036+
if (auto *IV = dyn_cast<VPWidenIntOrFpInductionRecipe>(&R))
1037+
Inc->setOperand(0, State->get(IV->getLastUnrolledPartOperand()));
1038+
continue;
10261039
}
10271040

1028-
Phi->setIncomingBlock(1, VectorLatchBB);
1029-
1030-
// Move the last step to the end of the latch block. This ensures
1031-
// consistent placement of all induction updates.
1032-
Instruction *Inc = cast<Instruction>(Phi->getIncomingValue(1));
1033-
Inc->moveBefore(VectorLatchBB->getTerminator()->getPrevNode());
1034-
1035-
// Use the steps for the last part as backedge value for the induction.
1036-
if (auto *IV = dyn_cast<VPWidenIntOrFpInductionRecipe>(&R))
1037-
Inc->setOperand(0, State->get(IV->getLastUnrolledPartOperand()));
1038-
continue;
1039-
}
1040-
1041-
auto *PhiR = cast<VPHeaderPHIRecipe>(&R);
1042-
bool NeedsScalar = isa<VPScalarPHIRecipe>(PhiR) ||
1043-
(isa<VPReductionPHIRecipe>(PhiR) &&
1044-
cast<VPReductionPHIRecipe>(PhiR)->isInLoop());
1045-
Value *Phi = State->get(PhiR, NeedsScalar);
1046-
Value *Val = State->get(PhiR->getBackedgeValue(), NeedsScalar);
1047-
cast<PHINode>(Phi)->addIncoming(Val, VectorLatchBB);
1041+
auto *PhiR = cast<VPHeaderPHIRecipe>(&R);
1042+
bool NeedsScalar = isa<VPScalarPHIRecipe>(PhiR) ||
1043+
(isa<VPReductionPHIRecipe>(PhiR) &&
1044+
cast<VPReductionPHIRecipe>(PhiR)->isInLoop());
1045+
Value *Phi = State->get(PhiR, NeedsScalar);
1046+
Value *Val = State->get(PhiR->getBackedgeValue(), NeedsScalar);
1047+
cast<PHINode>(Phi)->addIncoming(Val, VectorLatchBB);
10481048
}
10491049
}
10501050
}
@@ -1412,7 +1412,6 @@ void VPlanIngredient::print(raw_ostream &O) const {
14121412

14131413
#endif
14141414

1415-
14161415
bool VPValue::isDefinedOutsideLoopRegions() const {
14171416
auto *DefR = getDefiningRecipe();
14181417
if (!DefR)

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ struct VPlanTransforms {
135135
BasicBlock *UncountableExitingBlock,
136136
VPRecipeBuilder &RecipeBuilder);
137137

138-
/// Lower abstract recipes to concrete ones, that can be codegen'd and replace loop regions with explicit CFG.
138+
/// Lower abstract recipes to concrete ones, that can be codegen'd and replace
139+
/// loop regions with explicit CFG.
139140
static void convertToConcreteRecipes(VPlan &Plan);
140141

141142
/// If there's a single exit block, optimize its phi recipes that use exiting

0 commit comments

Comments
 (0)