Skip to content

Commit d371f10

Browse files
committed
!fixup address latest comments, thanks!
1 parent d4317a8 commit d371f10

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,13 +1135,8 @@ class VPPhiAccessors {
11351135
const VPBasicBlock *getIncomingBlock(unsigned Idx) const;
11361136

11371137
/// Returns the number of incoming values, also number of incoming blocks.
1138-
/// Note that at the moment, VPWidenIntOrFpInductionRecipes only have a single
1139-
/// incoming value, its start value.
1140-
unsigned getNumIncoming() const {
1141-
const VPRecipeBase *R = getAsRecipe();
1142-
return R->getVPDefID() == VPDef::VPWidenIntOrFpInductionSC
1143-
? 1
1144-
: getAsRecipe()->getNumOperands();
1138+
virtual unsigned getNumIncoming() const {
1139+
return getAsRecipe()->getNumOperands();
11451140
}
11461141

11471142
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -1992,6 +1987,11 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
19921987
return isUnrolled() ? getOperand(getNumOperands() - 2) : nullptr;
19931988
}
19941989

1990+
/// Returns the number of incoming values, also number of incoming blocks.
1991+
/// Note that at the moment, VPWidenIntOrFpInductionRecipes only have a single
1992+
/// incoming value, its start value.
1993+
unsigned getNumIncoming() const override { return 1; }
1994+
19951995
/// Returns the first defined value as TruncInst, if it is one or nullptr
19961996
/// otherwise.
19971997
TruncInst *getTruncInst() { return Trunc; }
@@ -3310,9 +3310,6 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
33103310

33113311
using Self = CastInfo<VPPhiAccessors, const VPRecipeBase *>;
33123312

3313-
using CastReturnType =
3314-
typename cast_retty<VPPhiAccessors, VPRecipeBase *>::ret_type;
3315-
33163313
static inline VPPhiAccessors *doCast(const VPRecipeBase *R) {
33173314
return const_cast<VPPhiAccessors *>([R]() -> const VPPhiAccessors * {
33183315
switch (R->getVPDefID()) {
@@ -3328,11 +3325,9 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
33283325
}());
33293326
}
33303327

3331-
static inline VPPhiAccessors *castFailed() { return nullptr; }
3332-
33333328
static inline VPPhiAccessors *doCastIfPossible(const VPRecipeBase *f) {
33343329
if (!Self::isPossible(f))
3335-
return castFailed();
3330+
return nullptr;
33363331
return doCast(f);
33373332
}
33383333
};

llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
222222
if (auto *Phi = dyn_cast<VPPhiAccessors>(UI)) {
223223
for (unsigned Idx = 0; Idx != Phi->getNumIncoming(); ++Idx) {
224224
VPValue *IncVPV = Phi->getIncomingValue(Idx);
225-
const VPBasicBlock *IncVPBB = Phi->getIncomingBlock(Idx);
226225
if (IncVPV != V)
227226
continue;
228-
if (IncVPBB != VPBB && !VPDT.dominates(VPBB, IncVPBB)) {
227+
const VPBasicBlock *IncVPBB = Phi->getIncomingBlock(Idx);
228+
if (!VPDT.dominates(VPBB, IncVPBB)) {
229229
errs() << "Incoming def at index " << Idx
230230
<< " does not dominate incoming block!\n";
231231
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -240,6 +240,7 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
240240
}
241241
continue;
242242
}
243+
// TODO: Also verify VPPredInstPHIRecipe.
243244
if (isa<VPPredInstPHIRecipe>(UI))
244245
continue;
245246

0 commit comments

Comments
 (0)