Skip to content

Commit f4428db

Browse files
fhahnrorth
authored andcommitted
[LV] Simplify finding EPResumeValue (NFC).
It should be sufficient to check that the resume phi has the correct type, as the vector trip count as incoming value and starts at 0 otherwise. There is no need to find the middle block.
1 parent 21ee1a0 commit f4428db

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9741,25 +9741,16 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
97419741
// VPlan.
97429742
// FIXME: Improve modeling for canonical IV start values in the epilogue
97439743
// loop.
9744-
BasicBlock *MainMiddle = find_singleton<BasicBlock>(
9745-
predecessors(L->getLoopPreheader()),
9746-
[&EPI](BasicBlock *BB, bool) -> BasicBlock * {
9747-
if (BB != EPI.MainLoopIterationCountCheck &&
9748-
BB != EPI.EpilogueIterationCountCheck &&
9749-
BB != EPI.SCEVSafetyCheck && BB != EPI.MemSafetyCheck)
9750-
return BB;
9751-
return nullptr;
9752-
});
97539744
using namespace llvm::PatternMatch;
97549745
Type *IdxTy = IV->getScalarType();
97559746
PHINode *EPResumeVal = find_singleton<PHINode>(
97569747
L->getLoopPreheader()->phis(),
9757-
[&EPI, IdxTy, MainMiddle](PHINode &P, bool) -> PHINode * {
9748+
[&EPI, IdxTy](PHINode &P, bool) -> PHINode * {
97589749
if (P.getType() == IdxTy &&
9759-
P.getIncomingValueForBlock(MainMiddle) == EPI.VectorTripCount &&
97609750
match(
97619751
P.getIncomingValueForBlock(EPI.MainLoopIterationCountCheck),
9762-
m_SpecificInt(0)))
9752+
m_SpecificInt(0)) &&
9753+
is_contained(P.incoming_values(), EPI.VectorTripCount))
97639754
return &P;
97649755
return nullptr;
97659756
});

0 commit comments

Comments
 (0)