Skip to content

Commit 93d9a31

Browse files
committed
!fixup address latest comments
1 parent 58a5e5d commit 93d9a31

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,19 +1026,22 @@ class VPInstruction : public VPRecipeWithIRFlags,
10261026
};
10271027

10281028
/// A recipe to wrap on original IR instruction not to be modified during
1029-
/// execution, execept for PHIs. For PHIs, a single VPValue operand is allowed,
1030-
/// and it is used to add a new incoming value for the single predecessor VPBB.
1029+
/// execution, except for PHIs. PHIs are modeled via the VPIRPhi subclass.
10311030
/// Expect PHIs, VPIRInstructions cannot have any operands.
10321031
class VPIRInstruction : public VPRecipeBase {
10331032
Instruction &I;
10341033

10351034
protected:
1035+
/// VPIRInstruction::create() should be used to create VPIRInstructions, as
1036+
/// subclasses may need to be created, e.g. VPIRPhi.
10361037
VPIRInstruction(Instruction &I)
10371038
: VPRecipeBase(VPDef::VPIRInstructionSC, ArrayRef<VPValue *>()), I(I) {}
10381039

10391040
public:
10401041
~VPIRInstruction() override = default;
10411042

1043+
/// Create a new VPIRPhi for \p \I, if it is a PHINode, otherwise create a
1044+
/// VPIRInstruction.
10421045
static VPIRInstruction *create(Instruction &I);
10431046

10441047
VP_CLASSOF_IMPL(VPDef::VPIRInstructionSC)
@@ -1089,7 +1092,9 @@ class VPIRInstruction : public VPRecipeBase {
10891092
};
10901093

10911094
/// An overlay for VPIRInstructions wrapping PHI nodes enabling convenient use
1092-
/// cast/dyn_cast/isa and execute() implementation.
1095+
/// cast/dyn_cast/isa and execute() implementation. A single VPValue operand is
1096+
/// allowed, and it is used to add a new incoming value for the single
1097+
/// predecessor VPBB.
10931098
struct VPIRPhi : public VPIRInstruction {
10941099
VPIRPhi(PHINode &PN) : VPIRInstruction(PN) {}
10951100

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,7 @@ void VPIRInstruction::print(raw_ostream &O, const Twine &Indent,
11061106
#endif
11071107

11081108
void VPIRPhi::execute(VPTransformState &State) {
1109+
assert(getNumOperands() > 0 && "VPIRPhi recipes must have operands");
11091110
PHINode *Phi = &getIRPhi();
11101111
for (const auto &[Idx, Op] : enumerate(operands())) {
11111112
VPValue *ExitValue = Op;

llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,9 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
208208
for (const VPUser *U : V->users()) {
209209
auto *UI = cast<VPRecipeBase>(U);
210210
// TODO: check dominance of incoming values for phis properly.
211-
if (!UI || isa<VPHeaderPHIRecipe, VPWidenPHIRecipe, VPPredInstPHIRecipe,
212-
VPIRPhi>(UI))
213211
if (!UI ||
214-
isa<VPHeaderPHIRecipe, VPWidenPHIRecipe, VPPredInstPHIRecipe>, VPIRPhi(UI) ||
212+
isa<VPHeaderPHIRecipe, VPWidenPHIRecipe, VPPredInstPHIRecipe,
213+
VPIRPhi>(UI) ||
215214
(isa<VPInstruction>(UI) &&
216215
cast<VPInstruction>(UI)->getOpcode() == Instruction::PHI))
217216
continue;

0 commit comments

Comments
 (0)