Skip to content

Commit 47fb9c4

Browse files
authored
[VPlan] Add Name argument to VPWidenPHIRecipe. NFC (#129527)
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 8266cd9 commit 47fb9c4

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
@@ -1932,11 +1932,16 @@ class VPScalarPHIRecipe : public VPHeaderPHIRecipe {
19321932
/// exactly 2 incoming values, the first from the predecessor of the region and
19331933
/// the second from the exiting block of the region.
19341934
class VPWidenPHIRecipe : public VPSingleDefRecipe {
1935+
/// Name to use for the generated IR instruction for the widened phi.
1936+
std::string Name;
1937+
19351938
public:
19361939
/// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start and
19371940
/// debug location \p DL.
1938-
VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {})
1939-
: VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef<VPValue *>(), Phi, DL) {
1941+
VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {},
1942+
const Twine &Name = "")
1943+
: VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef<VPValue *>(), Phi, DL),
1944+
Name(Name.str()) {
19401945
if (Start)
19411946
addOperand(Start);
19421947
}

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)