[Mlir-commits] [mlir] [mlir][acc] Ensure genAllocate uses provided variable name (PR #163861)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Oct 16 13:48:32 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 cpp,h -- mlir/include/mlir/Dialect/OpenACC/OpenACC.h mlir/lib/Dialect/OpenACC/IR/OpenACC.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/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
index 508708f11..90cbbd86d 100644
--- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
+++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
@@ -43,10 +43,9 @@ static bool isScalarLikeType(Type type) {
 /// Helper function to attach the `VarName` attribute to an operation
 /// if a variable name is provided.
 static void attachVarNameAttr(Operation *op, OpBuilder &builder,
-                                   StringRef varName) {
+                              StringRef varName) {
   if (!varName.empty()) {
-    auto varNameAttr =
-        acc::VarNameAttr::get(builder.getContext(), varName);
+    auto varNameAttr = acc::VarNameAttr::get(builder.getContext(), varName);
     op->setAttr(acc::getVarNameAttrName(), varNameAttr);
   }
 }
@@ -116,8 +115,9 @@ struct MemRefPointerLikeModel
         // Static dimensions are handled automatically by AllocOp
       }
       needsFree = true; // alloc needs deallocation
-      auto allocOp = memref::AllocOp::create(builder, loc, memrefTy, dynamicSizes);
-        attachVarNameAttr(allocOp, builder, varName);
+      auto allocOp =
+          memref::AllocOp::create(builder, loc, memrefTy, dynamicSizes);
+      attachVarNameAttr(allocOp, builder, varName);
       return allocOp.getResult();
     }
 

``````````

</details>


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


More information about the Mlir-commits mailing list