[Mlir-commits] [mlir] [MLIR][LLVM] add dwarfAddressSpace to DIDerivedType (PR #92043)

William G Hatch llvmlistbot at llvm.org
Tue May 14 08:25:48 PDT 2024


================
@@ -418,6 +418,7 @@ def LLVM_DIDerivedTypeAttr : LLVM_Attr<"DIDerivedType", "di_derived_type",
     OptionalParameter<"uint64_t">:$sizeInBits,
     OptionalParameter<"uint32_t">:$alignInBits,
     OptionalParameter<"uint64_t">:$offsetInBits,
+    OptionalParameter<"std::optional<unsigned>">:$dwarfAddressSpace,
----------------
willghatch wrote:

In one sense, I believe there is not a semantic difference in terms of what the debuginfo *means* between having no dwarf address space field and having a zero field, but the underlying LLVM implementation will do different things when it gets `std::nullopt` vs 0, IE omitting the field or emitting an attribute specifying `DW_AT_address_space` as 0.  For cases where you aren't targetting a GPU, it makes more sense to omit the attribute even if there is no semantic difference between a lack of attribute and a zero value.  Additionally, I'm not certain that all uses of the `DW_AT_address_space` attribute do ensure that zero is the same as lack of an attribute (IE there may be targets where there is a semantic difference that I'm unaware of).  I mainly modeled this to capture the behaviors of the underlying LLVM implementation, but I'll do a bit of digging to try to see whether it matters.

https://github.com/llvm/llvm-project/pull/92043


More information about the Mlir-commits mailing list