Skip to content

Commit f1bb53b

Browse files
committed
Address review comment
* Figure out context in addUsers... from the VPIRInstruction.
1 parent 22437d5 commit f1bb53b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8713,7 +8713,7 @@ static SetVector<VPIRInstruction *> collectUsersInExitBlock(
87138713
// Add exit values to \p Plan. Extracts are added for each entry in \p
87148714
// ExitUsersToFix if needed and their operands are updated.
87158715
static void
8716-
addUsersInExitBlock(VPlan &Plan, LLVMContext &Ctx,
8716+
addUsersInExitBlock(VPlan &Plan,
87178717
const SetVector<VPIRInstruction *> &ExitUsersToFix) {
87188718
if (ExitUsersToFix.empty())
87198719
return;
@@ -8730,6 +8730,7 @@ addUsersInExitBlock(VPlan &Plan, LLVMContext &Ctx,
87308730
if (V->isLiveIn())
87318731
continue;
87328732

8733+
LLVMContext &Ctx = ExitIRI->getInstruction().getContext();
87338734
VPValue *Ext = B.createNaryOp(VPInstruction::ExtractFromEnd,
87348735
{V, Plan.getOrAddLiveIn(ConstantInt::get(
87358736
IntegerType::get(Ctx, 32), 1))});
@@ -8895,10 +8896,9 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
88958896
return !CM.requiresScalarEpilogue(VF.isVector());
88968897
},
88978898
Range);
8898-
Type *WidestIndTy = Legal->getWidestInductionType();
8899-
VPlanPtr Plan =
8900-
VPlan::createInitialVPlan(WidestIndTy, PSE, RequiresScalarEpilogueCheck,
8901-
CM.foldTailByMasking(), OrigLoop);
8899+
VPlanPtr Plan = VPlan::createInitialVPlan(Legal->getWidestInductionType(),
8900+
PSE, RequiresScalarEpilogueCheck,
8901+
CM.foldTailByMasking(), OrigLoop);
89028902

89038903
// Don't use getDecisionAndClampRange here, because we don't know the UF
89048904
// so this function is better to be conservative, rather than to split
@@ -8913,7 +8913,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
89138913
// When not folding the tail, we know that the induction increment will not
89148914
// overflow.
89158915
bool HasNUW = Style == TailFoldingStyle::None;
8916-
addCanonicalIVRecipes(*Plan, WidestIndTy, HasNUW, DL);
8916+
addCanonicalIVRecipes(*Plan, Legal->getWidestInductionType(), HasNUW, DL);
89178917

89188918
VPRecipeBuilder RecipeBuilder(*Plan, OrigLoop, TLI, Legal, CM, PSE, Builder);
89198919

@@ -9045,7 +9045,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
90459045
SetVector<VPIRInstruction *> ExitUsersToFix = collectUsersInExitBlock(
90469046
OrigLoop, RecipeBuilder, *Plan, Legal->getInductionVars());
90479047
addLiveOutsForFirstOrderRecurrences(*Plan, ExitUsersToFix);
9048-
addUsersInExitBlock(*Plan, WidestIndTy->getContext(), ExitUsersToFix);
9048+
addUsersInExitBlock(*Plan, ExitUsersToFix);
90499049

90509050
// ---------------------------------------------------------------------------
90519051
// Transform initial VPlan: Apply previously taken decisions, in order, to

0 commit comments

Comments
 (0)