Skip to content

Commit ff4aec5

Browse files
authored
[VPlan] Deref VPlanPtr when passing to transform (NFC) (#161369)
For uniformity with other transforms.
1 parent 224a717 commit ff4aec5

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8694,7 +8694,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
86948694
Plan->addVF(VF);
86958695

86968696
if (!VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
8697-
Plan,
8697+
*Plan,
86988698
[this](PHINode *P) {
86998699
return Legal->getIntOrFpInductionDescriptor(P);
87008700
},

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ static cl::opt<bool> EnableWideActiveLaneMask(
4545
cl::desc("Enable use of wide get active lane mask instructions"));
4646

4747
bool VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
48-
VPlanPtr &Plan,
48+
VPlan &Plan,
4949
function_ref<const InductionDescriptor *(PHINode *)>
5050
GetIntOrFpInductionDescriptor,
5151
const TargetLibraryInfo &TLI) {
5252

5353
ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT(
54-
Plan->getVectorLoopRegion());
54+
Plan.getVectorLoopRegion());
5555
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
5656
// Skip blocks outside region
5757
if (!VPBB->getParent())
@@ -77,11 +77,11 @@ bool VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
7777
for (VPValue *Op : PhiR->operands())
7878
NewRecipe->addOperand(Op);
7979
} else {
80-
VPValue *Start = Plan->getOrAddLiveIn(II->getStartValue());
80+
VPValue *Start = Plan.getOrAddLiveIn(II->getStartValue());
8181
VPValue *Step =
82-
vputils::getOrCreateVPValueForSCEVExpr(*Plan, II->getStep());
82+
vputils::getOrCreateVPValueForSCEVExpr(Plan, II->getStep());
8383
NewRecipe = new VPWidenIntOrFpInductionRecipe(
84-
Phi, Start, Step, &Plan->getVF(), *II, Ingredient.getDebugLoc());
84+
Phi, Start, Step, &Plan.getVF(), *II, Ingredient.getDebugLoc());
8585
}
8686
} else {
8787
assert(isa<VPInstruction>(&Ingredient) &&

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ struct VPlanTransforms {
138138
/// widen recipes. Returns false if any VPInstructions could not be converted
139139
/// to a wide recipe if needed.
140140
LLVM_ABI_FOR_TEST static bool tryToConvertVPInstructionsToVPRecipes(
141-
VPlanPtr &Plan,
141+
VPlan &Plan,
142142
function_ref<const InductionDescriptor *(PHINode *)>
143143
GetIntOrFpInductionDescriptor,
144144
const TargetLibraryInfo &TLI);

llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {
203203
VPInstruction::BranchOnCond,
204204
{Plan->getOrAddLiveIn(ConstantInt::getTrue(F->getContext()))}));
205205
VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
206-
Plan, [](PHINode *P) { return nullptr; }, TLI);
206+
*Plan, [](PHINode *P) { return nullptr; }, TLI);
207207

208208
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
209209
EXPECT_EQ(0u, Entry->getNumPredecessors());

llvm/unittests/Transforms/Vectorize/VPlanUncountableExitTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ TEST_F(VPUncountableExitTest, FindUncountableExitRecipes) {
4848
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
4949
auto Plan = buildVPlan(LoopHeader, /*HasUncountableExit=*/true);
5050
VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
51-
Plan, [](PHINode *P) { return nullptr; }, *TLI);
51+
*Plan, [](PHINode *P) { return nullptr; }, *TLI);
5252
VPlanTransforms::runPass(VPlanTransforms::optimize, *Plan);
5353

5454
SmallVector<VPRecipeBase *> Recipes;
@@ -85,7 +85,7 @@ TEST_F(VPUncountableExitTest, NoUncountableExit) {
8585
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
8686
auto Plan = buildVPlan(LoopHeader);
8787
VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
88-
Plan, [](PHINode *P) { return nullptr; }, *TLI);
88+
*Plan, [](PHINode *P) { return nullptr; }, *TLI);
8989
VPlanTransforms::runPass(VPlanTransforms::optimize, *Plan);
9090

9191
SmallVector<VPRecipeBase *> Recipes;

0 commit comments

Comments
 (0)