[llvm] [VPlan] Simplify branch-cond with getVectorTripCount (PR #155604)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 03:50:43 PDT 2025
================
@@ -1483,14 +1483,15 @@ static bool simplifyBranchConditionForVFAndUF(VPlan &Plan, ElementCount BestVF,
// Try to simplify the branch condition if TC <= VF * UF when the latch
// terminator is BranchOnCount or BranchOnCond where the input is
// Not(ActiveLaneMask).
- const SCEV *TripCount =
- vputils::getSCEVExprForVPValue(Plan.getTripCount(), SE);
- assert(!isa<SCEVCouldNotCompute>(TripCount) &&
+ const SCEV *VectorTripCount =
+ vputils::getSCEVExprForVPValue(&Plan.getVectorTripCount(), SE);
+ if (isa<SCEVCouldNotCompute>(VectorTripCount))
+ VectorTripCount = vputils::getSCEVExprForVPValue(Plan.getTripCount(), SE);
+ assert(!isa<SCEVCouldNotCompute>(VectorTripCount) &&
----------------
lukel97 wrote:
> We don't have a vector trip count when there is a scalar tail.
Should that be the other way round, i.e we don't have a vector trip count when there is no scalar tail? The tests in this PR that are affected seem to have scalar tails
https://github.com/llvm/llvm-project/pull/155604
More information about the llvm-commits
mailing list