Skip to content

Commit a324d27

Browse files
committed
!fixup address latest comments, thanks!
1 parent 76212e6 commit a324d27

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ class InnerLoopVectorizer {
490490
MinProfitableTripCount(MinProfitableTripCount), UF(UnrollFactor),
491491
Builder(PSE.getSE()->getContext()), Cost(CM), BFI(BFI), PSI(PSI),
492492
RTChecks(RTChecks), Plan(Plan),
493-
VectorPHVPB(Plan.getEntry()->getSuccessors()[1]) {}
493+
VectorPHVPB(Plan.getVectorLoopRegion()->getSinglePredecessor()) {}
494494

495495
virtual ~InnerLoopVectorizer() = default;
496496

@@ -7870,6 +7870,8 @@ EpilogueVectorizerMainLoop::emitIterationCountCheck(BasicBlock *Bypass,
78707870
setBranchWeights(BI, MinItersBypassWeights, /*IsExpected=*/false);
78717871
ReplaceInstWithInst(TCCheckBlock->getTerminator(), &BI);
78727872

7873+
// Only generate add a new block for the trip-count check for the main loop.
7874+
// The epilogue will use the already existing VPlan entry block.
78737875
if (!ForEpilogue)
78747876
introduceCheckBlockInVPlan(TCCheckBlock);
78757877
return TCCheckBlock;

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,8 +4246,8 @@ class VPlan {
42464246
/// that this relies on unneeded branches to the scalar tail loop being
42474247
/// removed.
42484248
bool hasScalarTail() const {
4249-
return getScalarPreheader()->getNumPredecessors() != 0 &&
4250-
getScalarPreheader()->getSinglePredecessor() != getEntry();
4249+
return !(getScalarPreheader()->getNumPredecessors() == 0 ||
4250+
getScalarPreheader()->getSinglePredecessor() == getEntry());
42514251
}
42524252
};
42534253

0 commit comments

Comments
 (0)