Skip to content

Commit c61233f

Browse files
committed
!fixup address latest comments, thanks
1 parent 9113022 commit c61233f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,17 +1095,17 @@ template <typename RecipeTy> class VPPhiAccessors {
10951095
}
10961096

10971097
public:
1098-
/// Returns the \p I th incoming VPValue.
1099-
VPValue *getIncomingValue(unsigned I) const {
1100-
return getAsRecipe()->getOperand(I);
1098+
/// Returns the incoming VPValue with index \p Idx.
1099+
VPValue *getIncomingValue(unsigned Idx) const {
1100+
return getAsRecipe()->getOperand(Idx);
11011101
}
11021102

11031103
/// Returns an interator range over the incoming values
11041104
VPUser::const_operand_range incoming_values() const {
11051105
return getAsRecipe()->operands();
11061106
}
11071107

1108-
/// Returns the \p I th incoming block.
1108+
/// Returns the incoming block with index \p Idx.
11091109
const VPBasicBlock *getIncomingBlock(unsigned Idx) const;
11101110

11111111
using const_incoming_block_iterator =
@@ -1121,10 +1121,7 @@ template <typename RecipeTy> class VPPhiAccessors {
11211121
}
11221122
const_incoming_block_iterator incoming_block_end() const {
11231123
return const_incoming_block_iterator(
1124-
detail::index_iterator(getAsRecipe()->getVPDefID() ==
1125-
VPDef::VPWidenIntOrFpInductionSC
1126-
? 2
1127-
: getAsRecipe()->getNumOperands()),
1124+
detail::index_iterator(getAsRecipe()->getNumOperands()),
11281125
[this](size_t Idx) { return getIncomingBlock(Idx); });
11291126
}
11301127

@@ -1133,7 +1130,7 @@ template <typename RecipeTy> class VPPhiAccessors {
11331130
return make_range(incoming_block_begin(), incoming_block_end());
11341131
}
11351132

1136-
/// Returns an iterator range over pairs of incoming values and corrsponding
1133+
/// Returns an iterator range over pairs of incoming values and correspondingx
11371134
/// incoming blocks.
11381135
detail::zippy<llvm::detail::zip_shortest, VPUser::const_operand_range,
11391136
const_incoming_blocks_range>

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,24 +1042,27 @@ void VPIRInstruction::print(raw_ostream &O, const Twine &Indent,
10421042
}
10431043
#endif
10441044

1045+
/// Returns the incoming block at index \p Idx for \p R. This handles both
1046+
/// recipes placed in entry blocks of loop regions (incoming blocks are the
1047+
/// region's predecessor and the region's exit) and other locations (incoming
1048+
/// blocks are the direct predecessors).
10451049
static const VPBasicBlock *getIncomingBlockForRecipe(const VPRecipeBase *R,
1046-
unsigned I) {
1050+
unsigned Idx) {
10471051
const VPBasicBlock *Parent = R->getParent();
10481052
const VPBlockBase *Pred = nullptr;
10491053
if (Parent->getNumPredecessors() > 0) {
1050-
Pred = Parent->getPredecessors()[I];
1054+
Pred = Parent->getPredecessors()[Idx];
10511055
} else {
10521056
auto *Region = Parent->getParent();
10531057
assert(Region && !Region->isReplicator() && Region->getEntry() == Parent &&
10541058
"must be in the entry block of a non-replicate region");
10551059
assert(
1056-
I < 2 &&
1057-
(R->getNumOperands() == 2 || isa<VPWidenIntOrFpInductionRecipe>(R)) &&
1060+
Idx < 2 && R->getNumOperands() == 2 &&
10581061
"when placed in an entry block, only 2 incoming blocks are available");
10591062

1060-
// I == 0 selects the predecessor of the region, I == 1 selects the region
1061-
// itself whose exiting block feeds the phi across the backedge.
1062-
Pred = I == 0 ? Region->getSinglePredecessor() : Region;
1063+
// Idx == 0 selects the predecessor of the region, Idx == 1 selects the
1064+
// region itself whose exiting block feeds the phi across the backedge.
1065+
Pred = Idx == 0 ? Region->getSinglePredecessor() : Region;
10631066
}
10641067

10651068
return Pred->getExitingBasicBlock();

0 commit comments

Comments
 (0)