[Mlir-commits] [mlir] 276358f - [mlir][llvm] Make DI param optional to match LLVM

Christian Ulmann llvmlistbot at llvm.org
Fri Feb 17 04:08:55 PST 2023


Author: Christian Ulmann
Date: 2023-02-17T13:05:09+01:00
New Revision: 276358fd3af5e01b4e41e442703e835d26d36deb

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

LOG: [mlir][llvm] Make DI param optional to match LLVM

This commit makes DIDerivedTypeAttr's baseType parameter optional to ensure imported IR
doesn't break the printer.

Reviewed By: gysit

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
    mlir/test/Dialect/LLVMIR/debuginfo.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
index 85526c4186e5..6c4a8af1b22c 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
@@ -340,7 +340,7 @@ def LLVM_DIDerivedTypeAttr : LLVM_Attr<"DIDerivedType", "di_derived_type",
   let parameters = (ins
     LLVM_DITagParameter:$tag,
     OptionalParameter<"StringAttr">:$name,
-    "DITypeAttr":$baseType,
+    OptionalParameter<"DITypeAttr">:$baseType,
     OptionalParameter<"uint64_t">:$sizeInBits,
     OptionalParameter<"uint32_t">:$alignInBits,
     OptionalParameter<"uint64_t">:$offsetInBits

diff  --git a/mlir/test/Dialect/LLVMIR/debuginfo.mlir b/mlir/test/Dialect/LLVMIR/debuginfo.mlir
index d7123d971a68..7004d57762b9 100644
--- a/mlir/test/Dialect/LLVMIR/debuginfo.mlir
+++ b/mlir/test/Dialect/LLVMIR/debuginfo.mlir
@@ -30,10 +30,10 @@
   sizeInBits = 64, alignInBits = 32, offsetInBits = 4
 >
 
-// CHECK-DAG: #[[PTR1:.*]] = #llvm.di_derived_type<tag = DW_TAG_pointer_type, name = "ptr1", baseType = #[[INT0]]>
+// CHECK-DAG: #[[PTR1:.*]] = #llvm.di_derived_type<tag = DW_TAG_pointer_type, name = "ptr1">
 #ptr1 = #llvm.di_derived_type<
   // Specify the name parameter.
-  tag = DW_TAG_pointer_type, name = "ptr1", baseType = #int0
+  tag = DW_TAG_pointer_type, name = "ptr1"
 >
 
 // CHECK-DAG: #[[COMP0:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type, name = "array0", line = 10, sizeInBits = 128, alignInBits = 32>


        


More information about the Mlir-commits mailing list