Skip to content

Commit bf12e69

Browse files
committed
[VPlan] Add Name argument to VPWidenPHIRecipe. NFC
This allows a different IR name for the generated phi to be used. This is split off from #118638 and helps remove some of the diffs in it.
1 parent 71f4c7d commit bf12e69

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,11 +1938,16 @@ class VPScalarPHIRecipe : public VPHeaderPHIRecipe {
19381938
/// exactly 2 incoming values, the first from the predecessor of the region and
19391939
/// the second from the exiting block of the region.
19401940
class VPWidenPHIRecipe : public VPSingleDefRecipe {
1941+
/// Name to use for the generated IR instruction for the widened phi.
1942+
std::string Name;
1943+
19411944
public:
19421945
/// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start and
19431946
/// debug location \p DL.
1944-
VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {})
1945-
: VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef<VPValue *>(), Phi, DL) {
1947+
VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {},
1948+
const Twine &Name = "")
1949+
: VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef<VPValue *>(), Phi, DL),
1950+
Name(Name.str()) {
19461951
if (Start)
19471952
addOperand(Start);
19481953
}

llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
315315
// Phi node's operands may have not been visited at this point. We create
316316
// an empty VPInstruction that we will fix once the whole plain CFG has
317317
// been built.
318-
NewR = new VPWidenPHIRecipe(Phi, nullptr, Phi->getDebugLoc());
318+
NewR = new VPWidenPHIRecipe(Phi, nullptr, Phi->getDebugLoc(), "vec.phi");
319319
VPBB->appendRecipe(NewR);
320320
if (isHeaderBB(Phi->getParent(), LI->getLoopFor(Phi->getParent()))) {
321321
// Header phis need to be fixed after the VPBB for the latch has been

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3608,7 +3608,7 @@ void VPWidenPHIRecipe::execute(VPTransformState &State) {
36083608
State.setDebugLocFrom(getDebugLoc());
36093609
Value *Op0 = State.get(getOperand(0));
36103610
Type *VecTy = Op0->getType();
3611-
Value *VecPhi = State.Builder.CreatePHI(VecTy, 2, "vec.phi");
3611+
Value *VecPhi = State.Builder.CreatePHI(VecTy, 2, Name);
36123612
State.set(this, VecPhi);
36133613
}
36143614

0 commit comments

Comments
 (0)