diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -1224,7 +1224,7 @@ /// nodes after merging back from a Branch-on-Mask. VPPredInstPHIRecipe(VPValue *PredV) : VPRecipeBase(VPPredInstPHISC), VPUser(PredV) { - new VPValue(VPValue::VPValueSC, PredV->getUnderlyingValue(), this); + new VPValue(PredV->getUnderlyingValue(), this); } ~VPPredInstPHIRecipe() override = default; diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h --- a/llvm/lib/Transforms/Vectorize/VPlanValue.h +++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h @@ -35,7 +35,6 @@ class VPSlotTracker; class VPUser; class VPRecipeBase; -class VPPredInstPHIRecipe; class VPWidenMemoryInstructionRecipe; // This is the base class of the VPlan Def/Use graph, used for modeling the data @@ -51,7 +50,6 @@ friend class VPInterleavedAccessInfo; friend class VPSlotTracker; friend class VPRecipeBase; - friend class VPPredInstPHIRecipe; friend class VPWidenMemoryInstructionRecipe; const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast). @@ -168,6 +166,13 @@ void replaceAllUsesWith(VPValue *New); VPDef *getDef() { return Def; } + + /// Returns the underlying IR value, if this VPValue is defined outside the + /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef + /// inside a VPlan. + Value *getLiveInIRValue() { + return !getDef() ? getUnderlyingValue() : nullptr; + } }; typedef DenseMap Value2VPValueTy;