[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.
This commit is contained in:
Florian Hahn
2025-06-09 19:37:33 +01:00
parent 0e4b8b8f81
commit c2ea9404ab

View File

@@ -9741,25 +9741,16 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
// VPlan.
// FIXME: Improve modeling for canonical IV start values in the epilogue
// loop.
BasicBlock *MainMiddle = find_singleton<BasicBlock>(
predecessors(L->getLoopPreheader()),
[&EPI](BasicBlock *BB, bool) -> BasicBlock * {
if (BB != EPI.MainLoopIterationCountCheck &&
BB != EPI.EpilogueIterationCountCheck &&
BB != EPI.SCEVSafetyCheck && BB != EPI.MemSafetyCheck)
return BB;
return nullptr;
});
using namespace llvm::PatternMatch;
Type *IdxTy = IV->getScalarType();
PHINode *EPResumeVal = find_singleton<PHINode>(
L->getLoopPreheader()->phis(),
[&EPI, IdxTy, MainMiddle](PHINode &P, bool) -> PHINode * {
[&EPI, IdxTy](PHINode &P, bool) -> PHINode * {
if (P.getType() == IdxTy &&
P.getIncomingValueForBlock(MainMiddle) == EPI.VectorTripCount &&
match(
P.getIncomingValueForBlock(EPI.MainLoopIterationCountCheck),
m_SpecificInt(0)))
m_SpecificInt(0)) &&
is_contained(P.incoming_values(), EPI.VectorTripCount))
return &P;
return nullptr;
});