[Mlir-commits] [mlir] [mlir][inliner] Add doClone and canHandleMultipleBlocks callbacks to Inliner (PR #131226)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Apr 2 18:04:55 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 HEAD~1 HEAD --extensions h,cpp -- mlir/test/lib/Transforms/TestInliningCallback.cpp mlir/include/mlir/Transforms/Inliner.h mlir/include/mlir/Transforms/InliningUtils.h mlir/lib/Transforms/Utils/Inliner.cpp mlir/lib/Transforms/Utils/InliningUtils.cpp mlir/test/lib/Transforms/TestInlining.cpp mlir/tools/mlir-opt/mlir-opt.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Transforms/Utils/InliningUtils.cpp b/mlir/lib/Transforms/Utils/InliningUtils.cpp
index f624fc6fb..c1714fafc 100644
--- a/mlir/lib/Transforms/Utils/InliningUtils.cpp
+++ b/mlir/lib/Transforms/Utils/InliningUtils.cpp
@@ -55,12 +55,12 @@ static void
 remapInlinedLocations(iterator_range<Region::iterator> inlinedBlocks,
                       Location callerLoc) {
   DenseMap<Location, LocationAttr> mappedLocations;
+  LocationAttr newLoc = stackLocations(loc, callerLoc);
+  auto [it, inserted] = mappedLocations.try_emplace(loc);
+  // Only query the attribute uniquer once per callsite attribute.
+  if (inserted) {
     LocationAttr newLoc = stackLocations(loc, callerLoc);
-    auto [it, inserted] = mappedLocations.try_emplace(loc);
-    // Only query the attribute uniquer once per callsite attribute.
-    if (inserted) {
-      LocationAttr newLoc = stackLocations(loc, callerLoc);
-      it->getSecond() = newLoc;
+    it->getSecond() = newLoc;
     }
     return it->second;
   };

``````````

</details>


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


More information about the Mlir-commits mailing list