Skip to content

Commit 59bce4a

Browse files
committed
[VPlan] Consolidate logic for narrow to single scalars
The logic for narrowing to single scalar recipes is in two different places: narrowToSingleScalarRecipes and legalizeAndOptimizeInductions. Consolidate them, with minor test changes.
1 parent 02d9c71 commit 59bce4a

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -648,30 +648,6 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
648648
if (!PhiR)
649649
continue;
650650

651-
// Try to narrow wide and replicating recipes to uniform recipes, based on
652-
// VPlan analysis.
653-
// TODO: Apply to all recipes in the future, to replace legacy uniformity
654-
// analysis.
655-
auto Users = collectUsersRecursively(PhiR);
656-
for (VPUser *U : reverse(Users)) {
657-
auto *Def = dyn_cast<VPSingleDefRecipe>(U);
658-
auto *RepR = dyn_cast<VPReplicateRecipe>(U);
659-
// Skip recipes that shouldn't be narrowed.
660-
if (!Def || !isa<VPReplicateRecipe, VPWidenRecipe>(Def) ||
661-
Def->getNumUsers() == 0 || !Def->getUnderlyingValue() ||
662-
(RepR && (RepR->isSingleScalar() || RepR->isPredicated())))
663-
continue;
664-
665-
// Skip recipes that may have other lanes than their first used.
666-
if (!vputils::isSingleScalar(Def) && !vputils::onlyFirstLaneUsed(Def))
667-
continue;
668-
669-
auto *Clone = new VPReplicateRecipe(Def->getUnderlyingInstr(),
670-
Def->operands(), /*IsUniform*/ true);
671-
Clone->insertAfter(Def);
672-
Def->replaceAllUsesWith(Clone);
673-
}
674-
675651
// Replace wide pointer inductions which have only their scalars used by
676652
// PtrAdd(IndStart, ScalarIVSteps (0, Step)).
677653
if (auto *PtrIV = dyn_cast<VPWidenPointerInductionRecipe>(&Phi)) {

0 commit comments

Comments
 (0)