diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 0f1fa517be000..447ff0eceae24 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -1938,11 +1938,16 @@ class VPScalarPHIRecipe : public VPHeaderPHIRecipe { /// exactly 2 incoming values, the first from the predecessor of the region and /// the second from the exiting block of the region. class VPWidenPHIRecipe : public VPSingleDefRecipe { + /// Name to use for the generated IR instruction for the widened phi. + std::string Name; + public: /// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start and /// debug location \p DL. - VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {}) - : VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef(), Phi, DL) { + VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr, DebugLoc DL = {}, + const Twine &Name = "") + : VPSingleDefRecipe(VPDef::VPWidenPHISC, ArrayRef(), Phi, DL), + Name(Name.str()) { if (Start) addOperand(Start); } diff --git a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp index 19af0225c128f..a5e8e852bace8 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp @@ -315,7 +315,7 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB, // Phi node's operands may have not been visited at this point. We create // an empty VPInstruction that we will fix once the whole plain CFG has // been built. - NewR = new VPWidenPHIRecipe(Phi, nullptr, Phi->getDebugLoc()); + NewR = new VPWidenPHIRecipe(Phi, nullptr, Phi->getDebugLoc(), "vec.phi"); VPBB->appendRecipe(NewR); if (isHeaderBB(Phi->getParent(), LI->getLoopFor(Phi->getParent()))) { // Header phis need to be fixed after the VPBB for the latch has been diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index e9f50e88867b2..d154d54c37862 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -3608,7 +3608,7 @@ void VPWidenPHIRecipe::execute(VPTransformState &State) { State.setDebugLocFrom(getDebugLoc()); Value *Op0 = State.get(getOperand(0)); Type *VecTy = Op0->getType(); - Value *VecPhi = State.Builder.CreatePHI(VecTy, 2, "vec.phi"); + Value *VecPhi = State.Builder.CreatePHI(VecTy, 2, Name); State.set(this, VecPhi); }