-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[VPlan] Simplify branch-cond with getVectorTripCount #155604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1640,14 +1640,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) && | ||
"Trip count SCEV must be computable"); | ||
ElementCount NumElements = BestVF.multiplyCoefficientBy(BestUF); | ||
const SCEV *C = SE.getElementCount(TripCount->getType(), NumElements); | ||
if (TripCount->isZero() || | ||
!SE.isKnownPredicate(CmpInst::ICMP_ULE, TripCount, C)) | ||
const SCEV *C = SE.getElementCount(VectorTripCount->getType(), NumElements); | ||
if (!SE.isKnownPredicate(CmpInst::ICMP_ULE, VectorTripCount, C)) | ||
|
||
return false; | ||
} else if (match(Term, m_BranchOnCond(m_VPValue(Cond)))) { | ||
// For BranchOnCond, check if we can prove the condition to be true using VF | ||
|
Uh oh!
There was an error while loading. Please reload this page.