[PATCH] D61625: Debug Info: Support address space attributes on rvalue references.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 10:42:11 PDT 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360176: Debug Info: Support address space attributes on rvalue references. (authored by adrian, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61625?vs=198379&id=198499#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61625/new/

https://reviews.llvm.org/D61625

Files:
  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/trunk/lib/IR/Verifier.cpp
  llvm/trunk/test/DebugInfo/Generic/address_space_rvalue.ll
  llvm/trunk/test/Verifier/diderivedtype-address-space-rvalue-reference-type.ll


Index: llvm/trunk/test/Verifier/diderivedtype-address-space-rvalue-reference-type.ll
===================================================================
--- llvm/trunk/test/Verifier/diderivedtype-address-space-rvalue-reference-type.ll
+++ llvm/trunk/test/Verifier/diderivedtype-address-space-rvalue-reference-type.ll
@@ -1,6 +1,6 @@
-; RUN: not opt -S < %s 2>&1 | FileCheck %s
+; RUN: opt -S < %s 2>&1 | FileCheck %s
 
 !named = !{!0, !1}
 !0 = !DIBasicType(tag: DW_TAG_base_type, name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char)
-; CHECK: DWARF address space only applies to pointer or reference types
+; CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, {{.*}}, dwarfAddressSpace: 1)
 !1 = !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: !0, size: 32, align: 32, dwarfAddressSpace: 1)
Index: llvm/trunk/test/DebugInfo/Generic/address_space_rvalue.ll
===================================================================
--- llvm/trunk/test/DebugInfo/Generic/address_space_rvalue.ll
+++ llvm/trunk/test/DebugInfo/Generic/address_space_rvalue.ll
@@ -0,0 +1,26 @@
+; REQUIRES: object-emission
+
+; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s
+
+; This nonsensical example tests that address spaces for rvalue
+; references are produced.
+
+; CHECK: DW_TAG_rvalue_reference_type
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_address_class	(0x00000001)
+
+ at y = global i8* null, align 8, !dbg !0
+
+!llvm.dbg.cu = !{!5}
+!llvm.module.flags = !{!8, !9}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = !DIGlobalVariable(name: "x", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
+!2 = !DIFile(filename: "test.cpp", directory: "/")
+!3 = !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: !4, size: 64, align: 64, dwarfAddressSpace: 1)
+!4 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)
+!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.5.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, retainedTypes: !6, globals: !7, imports: !6)
+!6 = !{}
+!7 = !{!0}
+!8 = !{i32 2, !"Dwarf Version", i32 5}
+!9 = !{i32 1, !"Debug Info Version", i32 3}
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -794,10 +794,10 @@
   if (!DTy->isForwardDecl())
     addSourceLine(Buffer, DTy);
 
-  // If DWARF address space value is other than None, add it for pointer and
-  // reference types as DW_AT_address_class.
-  if (DTy->getDWARFAddressSpace() && (Tag == dwarf::DW_TAG_pointer_type ||
-                                      Tag == dwarf::DW_TAG_reference_type))
+  // If DWARF address space value is other than None, add it.  The IR
+  // verifier checks that DWARF address space only exists for pointer
+  // or reference types.
+  if (DTy->getDWARFAddressSpace())
     addUInt(Buffer, dwarf::DW_AT_address_class, dwarf::DW_FORM_data4,
             DTy->getDWARFAddressSpace().getValue());
 }
Index: llvm/trunk/lib/IR/Verifier.cpp
===================================================================
--- llvm/trunk/lib/IR/Verifier.cpp
+++ llvm/trunk/lib/IR/Verifier.cpp
@@ -926,7 +926,8 @@
 
   if (N.getDWARFAddressSpace()) {
     AssertDI(N.getTag() == dwarf::DW_TAG_pointer_type ||
-                 N.getTag() == dwarf::DW_TAG_reference_type,
+                 N.getTag() == dwarf::DW_TAG_reference_type ||
+                 N.getTag() == dwarf::DW_TAG_rvalue_reference_type,
              "DWARF address space only applies to pointer or reference types",
              &N);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61625.198499.patch
Type: text/x-patch
Size: 3792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190507/18e99840/attachment.bin>


More information about the llvm-commits mailing list