[llvm] [VPlan] Implement cloning of VPlans. (PR #73158)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:48:11 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1822bc15cb378458e942e405ae7da32ee75b8c5b f227f0f16c4eb18f0de57ab5f3e5fe418c2746c9 -- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlan.cpp llvm/lib/Transforms/Vectorize/VPlan.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index e7130a889e..e7df0024a7 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1259,12 +1259,15 @@ VPBlockBase *VPBlockUtils::cloneCFG(
       continue;
   }
 
-  // Update the operands of all cloned recipes starting at NewEntry. This traverses all reachable blocks. This is done in two steps, to handle cycles in PHI recipes.
+  // Update the operands of all cloned recipes starting at NewEntry. This
+  // traverses all reachable blocks. This is done in two steps, to handle cycles
+  // in PHI recipes.
   ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>>
       OldDeepRPOT(Entry);
   ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>>
       NewDeepRPOT(NewEntry);
-  // First, collect all mappings from old to new VPValues defined by cloned recipes.
+  // First, collect all mappings from old to new VPValues defined by cloned
+  // recipes.
   for (const auto &[OldBB, NewBB] :
        zip(VPBlockUtils::blocksOnly<VPBasicBlock>(OldDeepRPOT),
            VPBlockUtils::blocksOnly<VPBasicBlock>(NewDeepRPOT))) {
@@ -1276,7 +1279,7 @@ VPBlockBase *VPBlockUtils::cloneCFG(
 
   // Update all operands to use cloned VPValues.
   for (VPBasicBlock *NewBB :
-           VPBlockUtils::blocksOnly<VPBasicBlock>(NewDeepRPOT)) {
+       VPBlockUtils::blocksOnly<VPBasicBlock>(NewDeepRPOT)) {
     for (VPRecipeBase &NewR : *NewBB)
       for (unsigned I = 0, E = NewR.getNumOperands(); I != E; ++I) {
         VPValue *NewOp = Old2NewVPValues.lookup(NewR.getOperand(I));
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 83e689e5cb..d32ca14877 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3047,7 +3047,11 @@ public:
     });
   }
 
-  /// Clone the CFG for all nodes reachable from \p Entry, this includes cloning the blocks and their recipes. Operands of cloned recipes will be updated to use new VPValues from \p Old2NewValues. If \p FullRemapping is set to true, then all old VPValues from outside the cloned nodes must be mapped in \p Old2NewValues.
+  /// Clone the CFG for all nodes reachable from \p Entry, this includes cloning
+  /// the blocks and their recipes. Operands of cloned recipes will be updated
+  /// to use new VPValues from \p Old2NewValues. If \p FullRemapping is set to
+  /// true, then all old VPValues from outside the cloned nodes must be mapped
+  /// in \p Old2NewValues.
   static VPBlockBase *
   cloneCFG(VPBlockBase *Entry,
            DenseMap<VPBlockBase *, VPBlockBase *> &Old2NewBBs,

``````````

</details>


https://github.com/llvm/llvm-project/pull/73158


More information about the llvm-commits mailing list