[llvm] [VPlan] Add initial VPScalarEvolution, use to get trip count SCEV (NFC) (PR #94464)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 09:01:03 PDT 2024
================
@@ -674,10 +674,8 @@ void VPlanTransforms::optimizeForVFAndUF(VPlan &Plan, ElementCount BestVF,
m_BranchOnCond(m_Not(m_ActiveLaneMask(m_VPValue(), m_VPValue())))))
return;
- Type *IdxTy =
- Plan.getCanonicalIV()->getStartValue()->getLiveInIRValue()->getType();
- const SCEV *TripCount = createTripCountSCEV(IdxTy, PSE);
ScalarEvolution &SE = *PSE.getSE();
+ const SCEV *TripCount = VPScalarEvolution(SE).getSCEV(Plan.getTripCount());
----------------
ayalz wrote:
Suffice to have, in this case, as an alternative,
```suggestion
VPValue *TripCountVPV = Plan.getTripCount();
auto *Expand = dyn_cast<VPExpandSCEVRecipe>(TripCountVPV);
const SCEV *TripCount = Expand ? Expand->getSCEV() : SE.getSCEV(TripCountVPV->getLiveInIRValue());
```
asserting TripCountVPV is either an Expand or a live-in?
Perhaps could be folded into Plan.getTripCountSCEV(SE), or have vputils::getSCEVExprForVPValue() complement vputils::getOrCreateVPValueForSCEVExpr().
https://github.com/llvm/llvm-project/pull/94464
More information about the llvm-commits
mailing list