[Mlir-commits] [mlir] [mlir][scf] Expose mlir::generateUnrolledLoop() (PR #163806)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Oct 16 08:41:45 PDT 2025
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 origin/main HEAD --extensions h,cpp -- mlir/include/mlir/Dialect/SCF/Utils/Utils.h mlir/lib/Dialect/SCF/Utils/Utils.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
index 5c0908bb7..7f1e8e959 100644
--- a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
@@ -223,17 +223,17 @@ bool isPerfectlyNestedForLoops(MutableArrayRef<LoopLikeOpInterface> loops);
/// Generate unrolled copies of an scf loop's 'loopBodyBlock', with 'iterArgs'
/// and 'yieldedValues' as the block arguments and yielded values of the loop.
-/// The content of the loop body is replicated 'unrollFactor' times, calling 'ivRemapFn' to remap
-/// 'iv' for each unrolled body. If specified, annotates the Ops in each
-/// unrolled iteration using annotateFn.
-/// If provided, 'clonedToSrcOpsMap' is populated with the mappings from the cloned
-/// ops to the original op.
+/// The content of the loop body is replicated 'unrollFactor' times, calling
+/// 'ivRemapFn' to remap 'iv' for each unrolled body. If specified, annotates
+/// the Ops in each unrolled iteration using annotateFn. If provided,
+/// 'clonedToSrcOpsMap' is populated with the mappings from the cloned ops to
+/// the original op.
void generateUnrolledLoop(
Block *loopBodyBlock, Value iv, uint64_t unrollFactor,
function_ref<Value(unsigned, Value, OpBuilder)> ivRemapFn,
function_ref<void(unsigned, Operation *, OpBuilder)> annotateFn,
ValueRange iterArgs, ValueRange yieldedValues,
- IRMapping* clonedToSrcOpsMap = nullptr);
+ IRMapping *clonedToSrcOpsMap = nullptr);
} // namespace mlir
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5220ba6c7..af7aba26b 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -296,7 +296,7 @@ void mlir::generateUnrolledLoop(
function_ref<Value(unsigned, Value, OpBuilder)> ivRemapFn,
function_ref<void(unsigned, Operation *, OpBuilder)> annotateFn,
ValueRange iterArgs, ValueRange yieldedValues,
- IRMapping* clonedToSrcOpsMap) {
+ IRMapping *clonedToSrcOpsMap) {
// check if the op was cloned from another source op, and return it if found
// (or the same op if not found)
@@ -343,9 +343,9 @@ void mlir::generateUnrolledLoop(
Operation *srcOp = &(*it);
Operation *clonedOp = builder.clone(*srcOp, operandMap);
annotateFn(i, clonedOp, builder);
- if(clonedToSrcOpsMap)
+ if (clonedToSrcOpsMap)
clonedToSrcOpsMap->map(clonedOp,
- findOriginalSrcOp(srcOp, *clonedToSrcOpsMap));
+ findOriginalSrcOp(srcOp, *clonedToSrcOpsMap));
}
// Update yielded values.
``````````
</details>
https://github.com/llvm/llvm-project/pull/163806
More information about the Mlir-commits
mailing list