Skip to content

Commit 25b218c

Browse files
committed
!fixup address latest comments, thanks
1 parent e5c2270 commit 25b218c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,9 +1959,9 @@ class VPScalarPHIRecipe : public VPHeaderPHIRecipe {
19591959
};
19601960

19611961
/// A recipe for widened phis. Incoming values are operands of the recipe and
1962-
/// their operand index corresponds to the incoming predeocessor block. If the
1962+
/// their operand index corresponds to the incoming predecessor block. If the
19631963
/// recipe is placed in an entry block to a (non-replicate) region, it must have
1964-
/// exactly 2 incoming values, the first from the predecessors of the region and
1964+
/// exactly 2 incoming values, the first from the predecessor of the region and
19651965
/// the second from the exiting block of the region.
19661966
class VPWidenPHIRecipe : public VPSingleDefRecipe {
19671967
public:

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,7 +3612,9 @@ void VPReductionPHIRecipe::print(raw_ostream &O, const Twine &Indent,
36123612
VPBasicBlock *VPWidenPHIRecipe::getIncomingBlock(unsigned I) {
36133613
VPBasicBlock *Parent = getParent();
36143614
VPBlockBase *Pred = nullptr;
3615-
if (Parent->getNumPredecessors() == 0) {
3615+
if (Parent->getNumPredecessors() > 0) {
3616+
Pred = Parent->getPredecessors()[I];
3617+
} else {
36163618
auto *Region = Parent->getParent();
36173619
assert(Region && !Region->isReplicator() && Region->getEntry() == Parent &&
36183620
"must be in the entry block of a non-replicate region");
@@ -3623,8 +3625,6 @@ VPBasicBlock *VPWidenPHIRecipe::getIncomingBlock(unsigned I) {
36233625
// I == 0 selects the predecessor of the region, I == 1 selects the region
36243626
// itself whose exiting block feeds the phi across the backedge.
36253627
Pred = I == 0 ? Region->getSinglePredecessor() : Region;
3626-
} else {
3627-
Pred = Parent->getPredecessors()[I];
36283628
}
36293629

36303630
return Pred->getExitingBasicBlock();

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
694694
IntegerType *Int32 = IntegerType::get(C, 32);
695695
VPValue *Val = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 1));
696696
WidenPhi->addOperand(Val);
697+
WidenPhi->addOperand(Val);
697698
VPBB2->appendRecipe(WidenPhi);
698699

699700
VPBasicBlock *VPBBNew = Plan.createVPBasicBlock("VPBBNew");

0 commit comments

Comments
 (0)