[flang] [llvm] [clang] [mlir] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #77328)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 08:21:32 PST 2024


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 036e48e2f5f890e1f9574cdb610e2336f12038a2 d0c6477734356ac3ce898deb84e069ddbfc0fead -- mlir/include/mlir/Dialect/SCF/Transforms/Passes.h mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h mlir/include/mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp mlir/lib/Dialect/SCF/Utils/AffineCanonicalizationUtils.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
index 01f129c2b6..a24e3a2c2d 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -130,7 +130,7 @@ static LogicalResult splitLoopHelper(RewriterBase &b, scf::ForOp forOp,
   b.setInsertionPointAfter(forOp);
   IRMapping map;
   auto constStepOp =
-        b.create<arith::ConstantIndexOp>(forOp.getLoc(), *stepInt / 2);
+      b.create<arith::ConstantIndexOp>(forOp.getLoc(), *stepInt / 2);
   // The new for loop for the remaining iterations has half the step size
   // as continuous peeling requires the step size to diminish exponentially
   // across subsequent loops.
@@ -223,9 +223,9 @@ static LogicalResult continuousPeelForLoop(RewriterBase &b, ForOp forOp,
     // Canonicalize min/max affine operations
     currentLoop.walk([&](Operation *affineOp) {
       if (isa<AffineMinOp, AffineMaxOp>(affineOp))
-        scf::rewritePeeledMinMaxOp(
-            b, affineOp, currentLoop.getInductionVar(), initialUb, currentLoop.getStep(),
-            /*insideLoop=*/true);
+        scf::rewritePeeledMinMaxOp(b, affineOp, currentLoop.getInductionVar(),
+                                   initialUb, currentLoop.getStep(),
+                                   /*insideLoop=*/true);
 
       return WalkResult::advance();
     });

``````````

</details>


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


More information about the cfe-commits mailing list