[Mlir-commits] [mlir] dc2c4fc - [mlir][llvm] Allow inlining for dbg label

Tobias Gysi llvmlistbot at llvm.org
Fri Sep 1 07:57:18 PDT 2023


Author: Tobias Gysi
Date: 2023-09-01T14:55:38Z
New Revision: dc2c4fc784821bded8ef66198a68de9003edb3dd

URL: https://github.com/llvm/llvm-project/commit/dc2c4fc784821bded8ef66198a68de9003edb3dd
DIFF: https://github.com/llvm/llvm-project/commit/dc2c4fc784821bded8ef66198a68de9003edb3dd.diff

LOG: [mlir][llvm] Allow inlining for dbg label

The revision adds the dbg label intrinsic to the allow list of
operations that are legal to inline.

Reviewed By: zero9178

Differential Revision: https://reviews.llvm.org/D159359

Added: 
    

Modified: 
    mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
    mlir/test/Dialect/LLVMIR/inlining.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
index 3ee54249e8c393..b40be73ff21f70 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
@@ -695,6 +695,7 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
             LLVM::AtomicCmpXchgOp,
             LLVM::CallOp,
             LLVM::DbgDeclareOp,
+            LLVM::DbgLabelOp,
             LLVM::DbgValueOp,
             LLVM::FenceOp,
             LLVM::InlineAsmOp,

diff  --git a/mlir/test/Dialect/LLVMIR/inlining.mlir b/mlir/test/Dialect/LLVMIR/inlining.mlir
index b59f141e7acd29..3f14dc6de6b764 100644
--- a/mlir/test/Dialect/LLVMIR/inlining.mlir
+++ b/mlir/test/Dialect/LLVMIR/inlining.mlir
@@ -3,6 +3,7 @@
 #file = #llvm.di_file<"foo.mlir" in "/foo/">
 #variable = #llvm.di_local_variable<scope = #file>
 #variableAddr = #llvm.di_local_variable<scope = #file>
+#label = #llvm.di_label<scope = #file>
 
 func.func @inner_func_inlinable(%ptr : !llvm.ptr) -> i32 {
   %0 = llvm.mlir.constant(42 : i32) : i32
@@ -11,6 +12,7 @@ func.func @inner_func_inlinable(%ptr : !llvm.ptr) -> i32 {
   %1 = llvm.load %ptr { alignment = 8 } : !llvm.ptr -> i32
   llvm.intr.dbg.value #variable = %0 : i32
   llvm.intr.dbg.declare #variableAddr = %ptr : !llvm.ptr
+  llvm.intr.dbg.label #label
   %byte = llvm.mlir.constant(43 : i8) : i8
   %true = llvm.mlir.constant(1 : i1) : i1
   "llvm.intr.memset"(%ptr, %byte, %0) <{isVolatile = true}> : (!llvm.ptr, i8, i32) -> ()
@@ -37,6 +39,7 @@ func.func @inner_func_inlinable(%ptr : !llvm.ptr) -> i32 {
 // CHECK: %[[RES:.+]] = llvm.load %[[PTR]]
 // CHECK: llvm.intr.dbg.value #{{.+}} = %[[CST]]
 // CHECK: llvm.intr.dbg.declare #{{.+}} = %[[PTR]]
+// CHECK: llvm.intr.dbg.label #{{.+}}
 // CHECK: "llvm.intr.memset"(%[[PTR]]
 // CHECK: "llvm.intr.memmove"(%[[PTR]], %[[PTR]]
 // CHECK: "llvm.intr.memcpy"(%[[PTR]], %[[PTR]]


        


More information about the Mlir-commits mailing list