[llvm] 6a6b65a - [LV] Restructure code creating replicate region (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 18 10:17:32 PDT 2023


Author: Florian Hahn
Date: 2023-03-18T17:17:07Z
New Revision: 6a6b65a84cd5540e0f445665b064c8e54a07c8e8

URL: https://github.com/llvm/llvm-project/commit/6a6b65a84cd5540e0f445665b064c8e54a07c8e8
DIFF: https://github.com/llvm/llvm-project/commit/6a6b65a84cd5540e0f445665b064c8e54a07c8e8.diff

LOG: [LV] Restructure code creating replicate region (NFC).

Re-order recipe and block creation to be in order, as suggested
post-commit for 2db71c9851e5.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index e89eacdaa9649..f460d95f5e652 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8591,12 +8591,17 @@ VPRecipeBuilder::createReplicateRegion(VPReplicateRecipe *PredRecipe,
   std::string RegionName = (Twine("pred.") + Instr->getOpcodeName()).str();
   assert(Instr->getParent() && "Predicated instruction not in any basic block");
   auto *BlockInMask = PredRecipe->getMask();
+  auto *BOMRecipe = new VPBranchOnMaskRecipe(BlockInMask);
+  auto *Entry = new VPBasicBlock(Twine(RegionName) + ".entry", BOMRecipe);
+
   // Replace predicated replicate recipe with a replicate recipe without a
   // mask but in the replicate region.
   auto *RecipeWithoutMask = new VPReplicateRecipe(
       PredRecipe->getUnderlyingInstr(),
       make_range(PredRecipe->op_begin(), std::prev(PredRecipe->op_end())),
       PredRecipe->isUniform());
+  auto *Pred = new VPBasicBlock(Twine(RegionName) + ".if", RecipeWithoutMask);
+
   VPPredInstPHIRecipe *PHIRecipe = nullptr;
   if (PredRecipe->getNumUsers() != 0) {
     PHIRecipe = new VPPredInstPHIRecipe(RecipeWithoutMask);
@@ -8605,9 +8610,6 @@ VPRecipeBuilder::createReplicateRegion(VPReplicateRecipe *PredRecipe,
   }
   PredRecipe->eraseFromParent();
   auto *Exiting = new VPBasicBlock(Twine(RegionName) + ".continue", PHIRecipe);
-  auto *Pred = new VPBasicBlock(Twine(RegionName) + ".if", RecipeWithoutMask);
-  auto *BOMRecipe = new VPBranchOnMaskRecipe(BlockInMask);
-  auto *Entry = new VPBasicBlock(Twine(RegionName) + ".entry", BOMRecipe);
   VPRegionBlock *Region = new VPRegionBlock(Entry, Exiting, RegionName, true);
 
   // Note: first set Entry as region entry and then connect successors starting


        


More information about the llvm-commits mailing list