[Mlir-commits] [mlir] [mlir][LLVMIR] Avoid duplicate retained local variables (PR #209911)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jul 16 00:56:44 PDT 2026


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/lib/CAPI/Dialect/LLVM.cpp mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp mlir/lib/Target/LLVMIR/DebugImporter.cpp mlir/lib/Target/LLVMIR/DebugImporter.h mlir/lib/Target/LLVMIR/DebugTranslation.cpp mlir/lib/Target/LLVMIR/DebugTranslation.h mlir/lib/Target/LLVMIR/ModuleImport.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/CAPI/Dialect/LLVM.cpp b/mlir/lib/CAPI/Dialect/LLVM.cpp
index eb7e96925..d59fb3c86 100644
--- a/mlir/lib/CAPI/Dialect/LLVM.cpp
+++ b/mlir/lib/CAPI/Dialect/LLVM.cpp
@@ -415,9 +415,9 @@ MlirAttribute mlirLLVMDILocalVariableAttrGet(
     unsigned int alignInBits, MlirAttribute diType, int64_t flags) {
   return wrap(DILocalVariableAttr::get(
       unwrap(ctx), /*recId=*/DistinctAttr{}, /*isRecSelf=*/false,
-      cast<DIScopeAttr>(unwrap(scope)),
-      cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(diFile)), line,
-      arg, alignInBits, cast<DITypeAttr>(unwrap(diType)), DIFlags(flags)));
+      cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
+      cast<DIFileAttr>(unwrap(diFile)), line, arg, alignInBits,
+      cast<DITypeAttr>(unwrap(diType)), DIFlags(flags)));
 }
 
 MlirStringRef mlirLLVMDILocalVariableAttrGetName(void) {
diff --git a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
index fc387c0eb..473935fcf 100644
--- a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
@@ -363,10 +363,10 @@ DebugTranslation::translateRecursive(DIRecursiveTypeAttrInterface attr) {
 
   if (auto localVariable = dyn_cast<DILocalVariableAttr>(attr)) {
     if (localVariable.getIsRecSelf()) {
-      auto iter = forwardLocalVariablePlaceholders
-                      .try_emplace(recursiveId,
-                                   translateTemporaryImpl(localVariable))
-                      .first;
+      auto iter =
+          forwardLocalVariablePlaceholders
+              .try_emplace(recursiveId, translateTemporaryImpl(localVariable))
+              .first;
       return iter->second.get();
     }
     if (auto iter = forwardLocalVariablePlaceholders.find(recursiveId);

``````````

</details>


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


More information about the Mlir-commits mailing list