[llvm] c2ea940 - [LV] Simplify finding EPResumeValue (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 11:38:27 PDT 2025
Author: Florian Hahn
Date: 2025-06-09T19:37:33+01:00
New Revision: c2ea9404ab86892dcca38f585e32e5e1ab57e4cd
URL: https://github.com/llvm/llvm-project/commit/c2ea9404ab86892dcca38f585e32e5e1ab57e4cd
DIFF: https://github.com/llvm/llvm-project/commit/c2ea9404ab86892dcca38f585e32e5e1ab57e4cd.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index fc8ebebcf21b7..f2d4fe7f6ac4a 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -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;
});
More information about the llvm-commits
mailing list