[Mlir-commits] [mlir] 670ac23 - [RemoveDIs][MLIR] Don't process debug records in the LLVM-IR translator (#89735)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Apr 23 06:27:11 PDT 2024
Author: Stephen Tozer
Date: 2024-04-23T14:27:06+01:00
New Revision: 670ac235b52887b621ab9c75c6be7f5ac4ceb9f8
URL: https://github.com/llvm/llvm-project/commit/670ac235b52887b621ab9c75c6be7f5ac4ceb9f8
DIFF: https://github.com/llvm/llvm-project/commit/670ac235b52887b621ab9c75c6be7f5ac4ceb9f8.diff
LOG: [RemoveDIs][MLIR] Don't process debug records in the LLVM-IR translator (#89735)
We are almost ready to enable the use of debug records everywhere in
LLVM by default; part of the prep-work for this means ensuring that
every tool supports them. Every tool in the `llvm/` project supports
them, front-ends that use the `DIBuilder` will support them, and as far
as I can tell, the only other tool in the LLVM repo that needs to
support them but doesn't is `mlir-translate`. This patch trivially
unblocks them by converting from debug records to debug intrinsics
before translating a module.
Added:
Modified:
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
mlir/test/Target/LLVMIR/Import/import-failure.ll
Removed:
################################################################################
diff --git a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
index 101add70c51e29..7e2da1e0303c74 100644
--- a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -56,6 +56,10 @@ void registerFromLLVMIRTranslation() {
if (llvm::verifyModule(*llvmModule, &llvm::errs()))
return nullptr;
+ // Debug records are not currently supported in the LLVM IR translator.
+ if (llvmModule->IsNewDbgInfoFormat)
+ llvmModule->convertFromNewDbgValues();
+
return translateLLVMIRToModule(std::move(llvmModule), context,
emitExpensiveWarnings,
dropDICompositeTypeElements);
diff --git a/mlir/test/Target/LLVMIR/Import/import-failure.ll b/mlir/test/Target/LLVMIR/Import/import-failure.ll
index 3f4efab70e1c02..9c24ed2b75746b 100644
--- a/mlir/test/Target/LLVMIR/Import/import-failure.ll
+++ b/mlir/test/Target/LLVMIR/Import/import-failure.ll
@@ -64,12 +64,12 @@ define void @unhandled_intrinsic() gc "example" {
declare void @llvm.dbg.value(metadata, metadata, metadata)
; CHECK: import-failure.ll
-; CHECK-SAME: warning: dropped intrinsic: call void @llvm.dbg.value(metadata !DIArgList(i64 %{{.*}}, i64 undef), metadata !3, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value))
+; CHECK-SAME: warning: dropped intrinsic: tail call void @llvm.dbg.value(metadata !DIArgList(i64 %{{.*}}, i64 undef), metadata !3, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value))
; CHECK: import-failure.ll
-; CHECK-SAME: warning: dropped intrinsic: call void @llvm.dbg.value(metadata !6, metadata !3, metadata !DIExpression())
+; CHECK-SAME: warning: dropped intrinsic: tail call void @llvm.dbg.value(metadata !6, metadata !3, metadata !DIExpression())
define void @unsupported_argument(i64 %arg1) {
- call void @llvm.dbg.value(metadata !DIArgList(i64 %arg1, i64 undef), metadata !3, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value)), !dbg !5
- call void @llvm.dbg.value(metadata !6, metadata !3, metadata !DIExpression()), !dbg !5
+ tail call void @llvm.dbg.value(metadata !DIArgList(i64 %arg1, i64 undef), metadata !3, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value)), !dbg !5
+ tail call void @llvm.dbg.value(metadata !6, metadata !3, metadata !DIExpression()), !dbg !5
ret void
}
More information about the Mlir-commits
mailing list