From b9efffa7e9d01395ebd4ddbb7d0ecb02e017c76e Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 3 May 2023 19:51:09 +0100 Subject: [PATCH] [VPlan] Add assignSlot(const VPBasicBlock *) (NFC). Factor out utility to simplify D147964 as sugested. --- llvm/lib/Transforms/Vectorize/VPlan.cpp | 10 +++++++--- llvm/lib/Transforms/Vectorize/VPlanValue.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index 9e8ce60d2d9b..563421e398d0 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -1116,9 +1116,13 @@ void VPSlotTracker::assignSlots(const VPlan &Plan) { RPOT(VPBlockDeepTraversalWrapper(Plan.getEntry())); for (const VPBasicBlock *VPBB : VPBlockUtils::blocksOnly(RPOT)) - for (const VPRecipeBase &Recipe : *VPBB) - for (VPValue *Def : Recipe.definedValues()) - assignSlot(Def); + assignSlots(VPBB); +} + +void VPSlotTracker::assignSlots(const VPBasicBlock *VPBB) { + for (const VPRecipeBase &Recipe : *VPBB) + for (VPValue *Def : Recipe.definedValues()) + assignSlot(Def); } bool vputils::onlyFirstLaneUsed(VPValue *Def) { diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h index e861553cb56e..c1a30133a0f8 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanValue.h +++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h @@ -440,6 +440,7 @@ class VPSlotTracker { void assignSlot(const VPValue *V); void assignSlots(const VPlan &Plan); + void assignSlots(const VPBasicBlock *VPBB); public: VPSlotTracker(const VPlan *Plan = nullptr) {