|
22 | 22 | #include "VPlanDominatorTree.h" |
23 | 23 | #include "VPlanPatternMatch.h" |
24 | 24 | #include "VPlanTransforms.h" |
| 25 | +#include "VPlanUtils.h" |
25 | 26 | #include "llvm/ADT/PostOrderIterator.h" |
26 | 27 | #include "llvm/ADT/STLExtras.h" |
27 | 28 | #include "llvm/ADT/SmallVector.h" |
@@ -1602,53 +1603,6 @@ std::string VPSlotTracker::getOrCreateName(const VPValue *V) const { |
1602 | 1603 | return "<badref>"; |
1603 | 1604 | } |
1604 | 1605 |
|
1605 | | -bool vputils::onlyFirstLaneUsed(const VPValue *Def) { |
1606 | | - return all_of(Def->users(), |
1607 | | - [Def](const VPUser *U) { return U->onlyFirstLaneUsed(Def); }); |
1608 | | -} |
1609 | | - |
1610 | | -bool vputils::onlyFirstPartUsed(const VPValue *Def) { |
1611 | | - return all_of(Def->users(), |
1612 | | - [Def](const VPUser *U) { return U->onlyFirstPartUsed(Def); }); |
1613 | | -} |
1614 | | - |
1615 | | -VPValue *vputils::getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr, |
1616 | | - ScalarEvolution &SE) { |
1617 | | - if (auto *Expanded = Plan.getSCEVExpansion(Expr)) |
1618 | | - return Expanded; |
1619 | | - VPValue *Expanded = nullptr; |
1620 | | - if (auto *E = dyn_cast<SCEVConstant>(Expr)) |
1621 | | - Expanded = Plan.getOrAddLiveIn(E->getValue()); |
1622 | | - else if (auto *E = dyn_cast<SCEVUnknown>(Expr)) |
1623 | | - Expanded = Plan.getOrAddLiveIn(E->getValue()); |
1624 | | - else { |
1625 | | - Expanded = new VPExpandSCEVRecipe(Expr, SE); |
1626 | | - Plan.getPreheader()->appendRecipe(Expanded->getDefiningRecipe()); |
1627 | | - } |
1628 | | - Plan.addSCEVExpansion(Expr, Expanded); |
1629 | | - return Expanded; |
1630 | | -} |
1631 | | - |
1632 | | -bool vputils::isHeaderMask(const VPValue *V, VPlan &Plan) { |
1633 | | - if (isa<VPActiveLaneMaskPHIRecipe>(V)) |
1634 | | - return true; |
1635 | | - |
1636 | | - auto IsWideCanonicalIV = [](VPValue *A) { |
1637 | | - return isa<VPWidenCanonicalIVRecipe>(A) || |
1638 | | - (isa<VPWidenIntOrFpInductionRecipe>(A) && |
1639 | | - cast<VPWidenIntOrFpInductionRecipe>(A)->isCanonical()); |
1640 | | - }; |
1641 | | - |
1642 | | - VPValue *A, *B; |
1643 | | - if (match(V, m_ActiveLaneMask(m_VPValue(A), m_VPValue(B)))) |
1644 | | - return B == Plan.getTripCount() && |
1645 | | - (match(A, m_ScalarIVSteps(m_CanonicalIV(), m_SpecificInt(1))) || |
1646 | | - IsWideCanonicalIV(A)); |
1647 | | - |
1648 | | - return match(V, m_Binary<Instruction::ICmp>(m_VPValue(A), m_VPValue(B))) && |
1649 | | - IsWideCanonicalIV(A) && B == Plan.getOrCreateBackedgeTakenCount(); |
1650 | | -} |
1651 | | - |
1652 | 1606 | bool LoopVectorizationPlanner::getDecisionAndClampRange( |
1653 | 1607 | const std::function<bool(ElementCount)> &Predicate, VFRange &Range) { |
1654 | 1608 | assert(!Range.isEmpty() && "Trying to test an empty VF range."); |
|
0 commit comments