[llvm] [VPlan] Simplify VPPhi with all-equal incoming (PR #157414)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 8 13:56:01 PDT 2025
================
@@ -9568,6 +9568,16 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
// vectorizing the epilogue loop.
for (VPRecipeBase &R : Header->phis()) {
if (auto *IV = dyn_cast<VPCanonicalIVPHIRecipe>(&R)) {
+ // If we didn't find any PHIs, due to a simplification where all incoming
+ // values were equal (and necessarily zero), it means that the vector trip
+ // count is zero.
+ // TODO: We should not choose VF * UF so the main vector loop is known to
+ // be dead.
+ if (L->getLoopPreheader()->phis().empty()) {
+ EPI.VectorTripCount = ConstantInt::get(IV->getScalarType(), 0);
+ continue;
----------------
fhahn wrote:
can we asser that the scalar preheader in VPlan is unreachable?
https://github.com/llvm/llvm-project/pull/157414
More information about the llvm-commits
mailing list