Index: mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td =================================================================== --- mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td +++ mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td @@ -571,7 +571,8 @@ let arguments = (ins LLVM_AnyPointer:$addr, LLVM_DILocalVariableAttr:$varInfo); } -def LLVM_DbgValueOp : LLVM_DbgIntrOp<"dbg.value", "value"> { +def LLVM_DbgValueOp : LLVM_DbgIntrOp<"dbg.value", "value", + [DeclareOpInterfaceMethods]> { let summary = "Describes how the value relates to a source language variable."; let arguments = (ins LLVM_Type:$value, LLVM_DILocalVariableAttr:$varInfo); } Index: mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp =================================================================== --- mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp +++ mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp @@ -260,6 +260,17 @@ return DeletionKind::Delete; } +bool LLVM::DbgValueOp::canUsesBeRemoved( + const SmallPtrSetImpl &blockingUses, + SmallVectorImpl &newBlockingUses) { + return true; +} + +DeletionKind LLVM::DbgValueOp::removeBlockingUses( + const SmallPtrSetImpl &blockingUses, RewriterBase &rewriter) { + return DeletionKind::Delete; +} + //===----------------------------------------------------------------------===// // Interfaces for GEPOp //===----------------------------------------------------------------------===// Index: mlir/test/Dialect/LLVMIR/mem2reg-dbginfo.mlir =================================================================== --- mlir/test/Dialect/LLVMIR/mem2reg-dbginfo.mlir +++ mlir/test/Dialect/LLVMIR/mem2reg-dbginfo.mlir @@ -77,11 +77,13 @@ // CHECK-LABEL: llvm.func @always_drop_promoted_declare // CHECK-NOT: = llvm.alloca -// CHECK-NOT: llvm.intr.dbg. +// CHECK-NOT: llvm.intr.dbg.declare +// CHECK-NOT: llvm.intr.dbg.value llvm.func @always_drop_promoted_declare() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.intr.dbg.declare #di_local_variable = %1 : !llvm.ptr + llvm.intr.dbg.value #di_local_variable = %1 : !llvm.ptr llvm.return }