[Mlir-commits] [mlir] 393d57c - [MLIR][LLVM] Avoid creating unused NameLocs for imported functions (#163506)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 14 23:46:22 PDT 2025
Author: Christian Ulmann
Date: 2025-10-15T08:46:18+02:00
New Revision: 393d57c68a00a586622a85bc246c2023f5ecdeb1
URL: https://github.com/llvm/llvm-project/commit/393d57c68a00a586622a85bc246c2023f5ecdeb1
DIFF: https://github.com/llvm/llvm-project/commit/393d57c68a00a586622a85bc246c2023f5ecdeb1.diff
LOG: [MLIR][LLVM] Avoid creating unused NameLocs for imported functions (#163506)
This commit removes the creation of NameLocs when importing locations
for LLVM IR functions. This made the generated fused location more
complex by adding no valuable additional information to it. Note that
removing it has no effect on the roundtrip from LLVM IR back to LLVM IR.
Added:
Modified:
mlir/lib/Target/LLVMIR/DebugImporter.cpp
mlir/test/Target/LLVMIR/Import/debug-info.ll
Removed:
################################################################################
diff --git a/mlir/lib/Target/LLVMIR/DebugImporter.cpp b/mlir/lib/Target/LLVMIR/DebugImporter.cpp
index 4bbcd8e2177f3..db39c70c87531 100644
--- a/mlir/lib/Target/LLVMIR/DebugImporter.cpp
+++ b/mlir/lib/Target/LLVMIR/DebugImporter.cpp
@@ -34,11 +34,9 @@ Location DebugImporter::translateFuncLocation(llvm::Function *func) {
return UnknownLoc::get(context);
// Add a fused location to link the subprogram information.
- StringAttr funcName = StringAttr::get(context, subprogram->getName());
StringAttr fileName = StringAttr::get(context, subprogram->getFilename());
return FusedLocWith<DISubprogramAttr>::get(
- {NameLoc::get(funcName),
- FileLineColLoc::get(fileName, subprogram->getLine(), /*column=*/0)},
+ {FileLineColLoc::get(fileName, subprogram->getLine(), /*column=*/0)},
translate(subprogram), context);
}
diff --git a/mlir/test/Target/LLVMIR/Import/debug-info.ll b/mlir/test/Target/LLVMIR/Import/debug-info.ll
index e056e43a0982c..61376b8f648ec 100644
--- a/mlir/test/Target/LLVMIR/Import/debug-info.ll
+++ b/mlir/test/Target/LLVMIR/Import/debug-info.ll
@@ -240,11 +240,10 @@ define void @subprogram() !dbg !3 {
define void @func_loc() !dbg !3 {
ret void
}
-; CHECK-DAG: #[[NAME_LOC:.+]] = loc("func_loc")
; CHECK-DAG: #[[FILE_LOC:.+]] = loc("debug-info.ll":42:0)
; CHECK-DAG: #[[SP:.+]] = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #{{.*}}, scope = #{{.*}}, name = "func_loc", file = #{{.*}}, line = 42, subprogramFlags = Definition>
-; CHECK: loc(fused<#[[SP]]>[#[[NAME_LOC]], #[[FILE_LOC]]]
+; CHECK: loc(fused<#[[SP]]>[#[[FILE_LOC]]]
!llvm.dbg.cu = !{!1}
!llvm.module.flags = !{!0}
More information about the Mlir-commits
mailing list