DebugInfo: New metadata representation for global variables.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 13 Sep 2016 01:12:59 +0000 (01:12 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 13 Sep 2016 01:12:59 +0000 (01:12 +0000)
This patch reverses the edge from DIGlobalVariable to GlobalVariable.
This will allow us to more easily preserve debug info metadata when
manipulating global variables.

Fixes PR30362. A program for upgrading test cases is attached to that
bug.

Differential Revision: http://reviews.llvm.org/D20147

llvm-svn: 281284

159 files changed:
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/GlobalVariable.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
llvm/lib/CodeGen/GlobalMerge.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/IR/Metadata.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Linker/IRMover.cpp
llvm/lib/Transforms/IPO/StripSymbols.cpp
llvm/test/Assembler/diglobalvariable.ll
llvm/test/Bitcode/diglobalvariable-3.8.ll [new file with mode: 0644]
llvm/test/Bitcode/diglobalvariable-3.8.ll.bc [new file with mode: 0644]
llvm/test/Bitcode/dityperefs-3.8.ll
llvm/test/CodeGen/ARM/2010-06-25-Thumb2ITInvalidIterator.ll
llvm/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
llvm/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
llvm/test/CodeGen/ARM/coalesce-dbgvalue.ll
llvm/test/CodeGen/NVPTX/generic-to-nvvm-ir.ll
llvm/test/CodeGen/PowerPC/pr17168.ll
llvm/test/CodeGen/PowerPC/pr24546.ll
llvm/test/CodeGen/X86/fpstack-debuginstr-kill.ll
llvm/test/CodeGen/X86/misched-code-difference-with-debug.ll
llvm/test/DebugInfo/AArch64/big-endian.ll
llvm/test/DebugInfo/AArch64/bitfields.ll
llvm/test/DebugInfo/AArch64/frameindices.ll
llvm/test/DebugInfo/ARM/big-endian-bitfield.ll
llvm/test/DebugInfo/ARM/bitfield.ll
llvm/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
llvm/test/DebugInfo/ARM/tls.ll
llvm/test/DebugInfo/COFF/anonymous-struct.ll
llvm/test/DebugInfo/COFF/big-type.ll
llvm/test/DebugInfo/COFF/bitfields.ll
llvm/test/DebugInfo/COFF/enum.ll
llvm/test/DebugInfo/COFF/global-dllimport.ll
llvm/test/DebugInfo/COFF/globals-discarded.ll
llvm/test/DebugInfo/COFF/globals.ll
llvm/test/DebugInfo/COFF/inheritance.ll
llvm/test/DebugInfo/COFF/inlining-files.ll
llvm/test/DebugInfo/COFF/inlining-header.ll
llvm/test/DebugInfo/COFF/inlining-levels.ll
llvm/test/DebugInfo/COFF/register-variables.ll
llvm/test/DebugInfo/COFF/scopes.ll
llvm/test/DebugInfo/COFF/types-array-advanced.ll
llvm/test/DebugInfo/COFF/types-nested-class.ll
llvm/test/DebugInfo/COFF/types-ptr-to-member.ll
llvm/test/DebugInfo/COFF/udts.ll
llvm/test/DebugInfo/COFF/virtual-method-kinds.ll
llvm/test/DebugInfo/COFF/vtable-optzn-array.ll
llvm/test/DebugInfo/Generic/2009-11-06-NamelessGlobalVariable.ll
llvm/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll
llvm/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
llvm/test/DebugInfo/Generic/cross-cu-linkonce.ll
llvm/test/DebugInfo/Generic/dbg-at-specficiation.ll
llvm/test/DebugInfo/Generic/debuginfofinder-forward-declaration.ll
llvm/test/DebugInfo/Generic/dwarf-public-names.ll
llvm/test/DebugInfo/Generic/enum.ll
llvm/test/DebugInfo/Generic/gvn.ll
llvm/test/DebugInfo/Generic/member-pointers.ll
llvm/test/DebugInfo/Generic/namespace.ll
llvm/test/DebugInfo/Generic/recursive_inlining.ll
llvm/test/DebugInfo/Generic/template-recursive-void.ll
llvm/test/DebugInfo/Generic/tu-member-pointer.ll
llvm/test/DebugInfo/Generic/typedef.ll
llvm/test/DebugInfo/MIR/X86/live-debug-values.mir
llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll
llvm/test/DebugInfo/PowerPC/tls-fission.ll
llvm/test/DebugInfo/PowerPC/tls.ll
llvm/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
llvm/test/DebugInfo/X86/DIModuleContext.ll
llvm/test/DebugInfo/X86/DW_AT_calling-convention.ll
llvm/test/DebugInfo/X86/DW_AT_specification.ll
llvm/test/DebugInfo/X86/DW_TAG_friend.ll
llvm/test/DebugInfo/X86/InlinedFnLocalVar.ll
llvm/test/DebugInfo/X86/PR26148.ll
llvm/test/DebugInfo/X86/arange-and-stub.ll
llvm/test/DebugInfo/X86/arange.ll
llvm/test/DebugInfo/X86/bitfields-dwarf4.ll
llvm/test/DebugInfo/X86/bitfields.ll
llvm/test/DebugInfo/X86/c-type-units.ll
llvm/test/DebugInfo/X86/concrete_out_of_line.ll
llvm/test/DebugInfo/X86/cu-ranges-odr.ll
llvm/test/DebugInfo/X86/data_member_location.ll
llvm/test/DebugInfo/X86/dbg-subrange.ll
llvm/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
llvm/test/DebugInfo/X86/debug-info-access.ll
llvm/test/DebugInfo/X86/debug-info-packed-struct.ll
llvm/test/DebugInfo/X86/debug-info-static-member.ll
llvm/test/DebugInfo/X86/debug-loc-frame.ll
llvm/test/DebugInfo/X86/debugger-tune.ll
llvm/test/DebugInfo/X86/decl-derived-member.ll
llvm/test/DebugInfo/X86/dllimport.ll
llvm/test/DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll
llvm/test/DebugInfo/X86/dwarf-aranges.ll
llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
llvm/test/DebugInfo/X86/dwarf-public-names.ll
llvm/test/DebugInfo/X86/empty-array.ll
llvm/test/DebugInfo/X86/enum-class.ll
llvm/test/DebugInfo/X86/enum-fwd-decl.ll
llvm/test/DebugInfo/X86/externaltyperef.ll
llvm/test/DebugInfo/X86/fission-cu.ll
llvm/test/DebugInfo/X86/generate-odr-hash.ll
llvm/test/DebugInfo/X86/gnu-public-names.ll
llvm/test/DebugInfo/X86/inline-member-function.ll
llvm/test/DebugInfo/X86/inlined-indirect-value.ll
llvm/test/DebugInfo/X86/isel-cse-line.ll
llvm/test/DebugInfo/X86/linkage-name.ll
llvm/test/DebugInfo/X86/live-debug-values.ll
llvm/test/DebugInfo/X86/memberfnptr.ll
llvm/test/DebugInfo/X86/misched-dbg-value.ll
llvm/test/DebugInfo/X86/multiple-aranges.ll
llvm/test/DebugInfo/X86/multiple-at-const-val.ll
llvm/test/DebugInfo/X86/nondefault-subrange-array.ll
llvm/test/DebugInfo/X86/objc-fwd-decl.ll
llvm/test/DebugInfo/X86/pointer-type-size.ll
llvm/test/DebugInfo/X86/pr12831.ll
llvm/test/DebugInfo/X86/ref_addr_relocation.ll
llvm/test/DebugInfo/X86/stack-value-dwarf4.ll [new file with mode: 0644]
llvm/test/DebugInfo/X86/stringpool.ll
llvm/test/DebugInfo/X86/struct-loc.ll
llvm/test/DebugInfo/X86/template.ll
llvm/test/DebugInfo/X86/tls.ll
llvm/test/DebugInfo/X86/type_units_with_addresses.ll
llvm/test/DebugInfo/X86/unattached-global.ll [new file with mode: 0644]
llvm/test/DebugInfo/X86/union-template.ll
llvm/test/DebugInfo/X86/vector.ll
llvm/test/Linker/2011-08-04-Metadata.ll
llvm/test/Linker/2011-08-04-Metadata2.ll
llvm/test/Linker/odr.ll
llvm/test/Linker/only-needed-debug-metadata.ll
llvm/test/ThinLTO/X86/Inputs/crash_debuginfo.ll
llvm/test/ThinLTO/X86/Inputs/drop-debug-info.ll
llvm/test/ThinLTO/X86/crash_debuginfo.ll
llvm/test/Transforms/GCOVProfiling/return-block.ll
llvm/test/Transforms/GlobalMerge/debug-info.ll [new file with mode: 0644]
llvm/test/Transforms/GlobalOpt/2009-03-05-dbg.ll
llvm/test/Transforms/Inline/alloca-dbgdeclare.ll
llvm/test/Transforms/LoopVectorize/dbg.value.ll
llvm/test/Transforms/SampleProfile/cov-zero-samples.ll
llvm/test/Transforms/SimplifyCFG/PR27615-simplify-cond-br.ll
llvm/test/Transforms/StripSymbols/2010-06-30-StripDebug.ll
llvm/test/Transforms/StripSymbols/strip-dead-debug-info.ll
llvm/test/tools/llvm-objdump/Hexagon/source-interleave-hexagon.ll
llvm/test/tools/llvm-objdump/X86/source-interleave-x86_64.ll
llvm/unittests/IR/MetadataTest.cpp
llvm/unittests/IR/VerifierTest.cpp

index c68f06e..babde44 100644 (file)
@@ -454,20 +454,21 @@ namespace llvm {
     /// \param Ty          Variable Type.
     /// \param isLocalToUnit Boolean flag indicate whether this variable is
     ///                      externally visible or not.
-    /// \param Val         llvm::Value of the variable.
+    /// \param Expr        The location of the global relative to the attached
+    ///                    GlobalVariable.
     /// \param Decl        Reference to the corresponding declaration.
     DIGlobalVariable *createGlobalVariable(DIScope *Context, StringRef Name,
                                            StringRef LinkageName, DIFile *File,
                                            unsigned LineNo, DIType *Ty,
                                            bool isLocalToUnit,
-                                           llvm::Constant *Val,
+                                           DIExpression *Expr = nullptr,
                                            MDNode *Decl = nullptr);
 
     /// Identical to createGlobalVariable
     /// except that the resulting DbgNode is temporary and meant to be RAUWed.
     DIGlobalVariable *createTempGlobalVariableFwdDecl(
         DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
-        unsigned LineNo, DIType *Ty, bool isLocalToUnit, llvm::Constant *Val,
+        unsigned LineNo, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
         MDNode *Decl = nullptr);
 
     /// Create a new descriptor for an auto variable.  This is a local variable
@@ -514,6 +515,13 @@ namespace llvm {
     DIExpression *createBitPieceExpression(unsigned OffsetInBits,
                                            unsigned SizeInBits);
 
+    /// Create an expression for a variable that does not have an address, but
+    /// does have a constant value.
+    DIExpression *createConstantValueExpression(uint64_t Val) {
+      return DIExpression::get(
+          VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
+    }
+
     /// Create a new descriptor for the specified subprogram.
     /// See comments in DISubprogram* for descriptions of these fields.
     /// \param Scope         Function scope.
index 165af62..84763f4 100644 (file)
@@ -1862,6 +1862,159 @@ public:
   }
 };
 
+/// \brief DWARF expression.
+///
+/// This is (almost) a DWARF expression that modifies the location of a
+/// variable, or the location of a single piece of a variable, or (when using
+/// DW_OP_stack_value) is the constant variable value.
+///
+/// FIXME: Instead of DW_OP_plus taking an argument, this should use DW_OP_const
+/// and have DW_OP_plus consume the topmost elements on the stack.
+///
+/// TODO: Co-allocate the expression elements.
+/// TODO: Separate from MDNode, or otherwise drop Distinct and Temporary
+/// storage types.
+class DIExpression : public MDNode {
+  friend class LLVMContextImpl;
+  friend class MDNode;
+
+  std::vector<uint64_t> Elements;
+
+  DIExpression(LLVMContext &C, StorageType Storage, ArrayRef<uint64_t> Elements)
+      : MDNode(C, DIExpressionKind, Storage, None),
+        Elements(Elements.begin(), Elements.end()) {}
+  ~DIExpression() = default;
+
+  static DIExpression *getImpl(LLVMContext &Context,
+                               ArrayRef<uint64_t> Elements, StorageType Storage,
+                               bool ShouldCreate = true);
+
+  TempDIExpression cloneImpl() const {
+    return getTemporary(getContext(), getElements());
+  }
+
+public:
+  DEFINE_MDNODE_GET(DIExpression, (ArrayRef<uint64_t> Elements), (Elements))
+
+  TempDIExpression clone() const { return cloneImpl(); }
+
+  ArrayRef<uint64_t> getElements() const { return Elements; }
+
+  unsigned getNumElements() const { return Elements.size(); }
+  uint64_t getElement(unsigned I) const {
+    assert(I < Elements.size() && "Index out of range");
+    return Elements[I];
+  }
+
+  /// Return whether this is a piece of an aggregate variable.
+  bool isBitPiece() const;
+
+  /// Return the offset of this piece in bits.
+  uint64_t getBitPieceOffset() const;
+
+  /// Return the size of this piece in bits.
+  uint64_t getBitPieceSize() const;
+
+  typedef ArrayRef<uint64_t>::iterator element_iterator;
+  element_iterator elements_begin() const { return getElements().begin(); }
+  element_iterator elements_end() const { return getElements().end(); }
+
+  /// A lightweight wrapper around an expression operand.
+  ///
+  /// TODO: Store arguments directly and change \a DIExpression to store a
+  /// range of these.
+  class ExprOperand {
+    const uint64_t *Op;
+
+  public:
+    explicit ExprOperand(const uint64_t *Op) : Op(Op) {}
+
+    const uint64_t *get() const { return Op; }
+
+    /// Get the operand code.
+    uint64_t getOp() const { return *Op; }
+
+    /// Get an argument to the operand.
+    ///
+    /// Never returns the operand itself.
+    uint64_t getArg(unsigned I) const { return Op[I + 1]; }
+
+    unsigned getNumArgs() const { return getSize() - 1; }
+
+    /// Return the size of the operand.
+    ///
+    /// Return the number of elements in the operand (1 + args).
+    unsigned getSize() const;
+  };
+
+  /// An iterator for expression operands.
+  class expr_op_iterator
+      : public std::iterator<std::input_iterator_tag, ExprOperand> {
+    ExprOperand Op;
+
+  public:
+    explicit expr_op_iterator(element_iterator I) : Op(I) {}
+
+    element_iterator getBase() const { return Op.get(); }
+    const ExprOperand &operator*() const { return Op; }
+    const ExprOperand *operator->() const { return &Op; }
+
+    expr_op_iterator &operator++() {
+      increment();
+      return *this;
+    }
+    expr_op_iterator operator++(int) {
+      expr_op_iterator T(*this);
+      increment();
+      return T;
+    }
+
+    /// Get the next iterator.
+    ///
+    /// \a std::next() doesn't work because this is technically an
+    /// input_iterator, but it's a perfectly valid operation.  This is an
+    /// accessor to provide the same functionality.
+    expr_op_iterator getNext() const { return ++expr_op_iterator(*this); }
+
+    bool operator==(const expr_op_iterator &X) const {
+      return getBase() == X.getBase();
+    }
+    bool operator!=(const expr_op_iterator &X) const {
+      return getBase() != X.getBase();
+    }
+
+  private:
+    void increment() { Op = ExprOperand(getBase() + Op.getSize()); }
+  };
+
+  /// Visit the elements via ExprOperand wrappers.
+  ///
+  /// These range iterators visit elements through \a ExprOperand wrappers.
+  /// This is not guaranteed to be a valid range unless \a isValid() gives \c
+  /// true.
+  ///
+  /// \pre \a isValid() gives \c true.
+  /// @{
+  expr_op_iterator expr_op_begin() const {
+    return expr_op_iterator(elements_begin());
+  }
+  expr_op_iterator expr_op_end() const {
+    return expr_op_iterator(elements_end());
+  }
+  /// @}
+
+  bool isValid() const;
+
+  static bool classof(const Metadata *MD) {
+    return MD->getMetadataID() == DIExpressionKind;
+  }
+
+  /// Is the first element a DW_OP_deref?.
+  bool startsWithDeref() const {
+    return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
+  }
+};
+
 /// \brief Global variables.
 ///
 /// TODO: Remove DisplayName.  It's always equal to Name.
@@ -1882,26 +2035,25 @@ class DIGlobalVariable : public DIVariable {
   static DIGlobalVariable *
   getImpl(LLVMContext &Context, DIScope *Scope, StringRef Name,
           StringRef LinkageName, DIFile *File, unsigned Line, DITypeRef Type,
-          bool IsLocalToUnit, bool IsDefinition, Constant *Variable,
+          bool IsLocalToUnit, bool IsDefinition, DIExpression *Expr,
           DIDerivedType *StaticDataMemberDeclaration, StorageType Storage,
           bool ShouldCreate = true) {
     return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
                    getCanonicalMDString(Context, LinkageName), File, Line, Type,
-                   IsLocalToUnit, IsDefinition,
-                   Variable ? ConstantAsMetadata::get(Variable) : nullptr,
+                   IsLocalToUnit, IsDefinition, Expr,
                    StaticDataMemberDeclaration, Storage, ShouldCreate);
   }
   static DIGlobalVariable *
   getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
           MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
-          bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
+          bool IsLocalToUnit, bool IsDefinition, Metadata *Expr,
           Metadata *StaticDataMemberDeclaration, StorageType Storage,
           bool ShouldCreate = true);
 
   TempDIGlobalVariable cloneImpl() const {
     return getTemporary(getContext(), getScope(), getName(), getLinkageName(),
                         getFile(), getLine(), getType(), isLocalToUnit(),
-                        isDefinition(), getVariable(),
+                        isDefinition(), getExpr(),
                         getStaticDataMemberDeclaration());
   }
 
@@ -1909,17 +2061,17 @@ public:
   DEFINE_MDNODE_GET(DIGlobalVariable,
                     (DIScope * Scope, StringRef Name, StringRef LinkageName,
                      DIFile *File, unsigned Line, DITypeRef Type,
-                     bool IsLocalToUnit, bool IsDefinition, Constant *Variable,
+                     bool IsLocalToUnit, bool IsDefinition, DIExpression *Expr,
                      DIDerivedType *StaticDataMemberDeclaration),
                     (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
-                     IsDefinition, Variable, StaticDataMemberDeclaration))
+                     IsDefinition, Expr, StaticDataMemberDeclaration))
   DEFINE_MDNODE_GET(DIGlobalVariable,
                     (Metadata * Scope, MDString *Name, MDString *LinkageName,
                      Metadata *File, unsigned Line, Metadata *Type,
-                     bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
+                     bool IsLocalToUnit, bool IsDefinition, Metadata *Expr,
                      Metadata *StaticDataMemberDeclaration),
                     (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
-                     IsDefinition, Variable, StaticDataMemberDeclaration))
+                     IsDefinition, Expr, StaticDataMemberDeclaration))
 
   TempDIGlobalVariable clone() const { return cloneImpl(); }
 
@@ -1927,17 +2079,18 @@ public:
   bool isDefinition() const { return IsDefinition; }
   StringRef getDisplayName() const { return getStringOperand(4); }
   StringRef getLinkageName() const { return getStringOperand(5); }
-  Constant *getVariable() const {
-    if (auto *C = cast_or_null<ConstantAsMetadata>(getRawVariable()))
-      return dyn_cast<Constant>(C->getValue());
-    return nullptr;
+  DIExpression *getExpr() const {
+    return cast_or_null<DIExpression>(getRawExpr());
+  }
+  void replaceExpr(DIExpression *E) {
+    replaceOperandWith(6, E);
   }
   DIDerivedType *getStaticDataMemberDeclaration() const {
     return cast_or_null<DIDerivedType>(getRawStaticDataMemberDeclaration());
   }
 
   MDString *getRawLinkageName() const { return getOperandAs<MDString>(5); }
-  Metadata *getRawVariable() const { return getOperand(6); }
+  Metadata *getRawExpr() const { return getOperand(6); }
   Metadata *getRawStaticDataMemberDeclaration() const { return getOperand(7); }
 
   static bool classof(const Metadata *MD) {
@@ -2024,158 +2177,6 @@ public:
   }
 };
 
-/// \brief DWARF expression.
-///
-/// This is (almost) a DWARF expression that modifies the location of a
-/// variable or (or the location of a single piece of a variable).
-///
-/// FIXME: Instead of DW_OP_plus taking an argument, this should use DW_OP_const
-/// and have DW_OP_plus consume the topmost elements on the stack.
-///
-/// TODO: Co-allocate the expression elements.
-/// TODO: Separate from MDNode, or otherwise drop Distinct and Temporary
-/// storage types.
-class DIExpression : public MDNode {
-  friend class LLVMContextImpl;
-  friend class MDNode;
-
-  std::vector<uint64_t> Elements;
-
-  DIExpression(LLVMContext &C, StorageType Storage, ArrayRef<uint64_t> Elements)
-      : MDNode(C, DIExpressionKind, Storage, None),
-        Elements(Elements.begin(), Elements.end()) {}
-  ~DIExpression() = default;
-
-  static DIExpression *getImpl(LLVMContext &Context,
-                               ArrayRef<uint64_t> Elements, StorageType Storage,
-                               bool ShouldCreate = true);
-
-  TempDIExpression cloneImpl() const {
-    return getTemporary(getContext(), getElements());
-  }
-
-public:
-  DEFINE_MDNODE_GET(DIExpression, (ArrayRef<uint64_t> Elements), (Elements))
-
-  TempDIExpression clone() const { return cloneImpl(); }
-
-  ArrayRef<uint64_t> getElements() const { return Elements; }
-
-  unsigned getNumElements() const { return Elements.size(); }
-  uint64_t getElement(unsigned I) const {
-    assert(I < Elements.size() && "Index out of range");
-    return Elements[I];
-  }
-
-  /// \brief Return whether this is a piece of an aggregate variable.
-  bool isBitPiece() const;
-
-  /// \brief Return the offset of this piece in bits.
-  uint64_t getBitPieceOffset() const;
-
-  /// \brief Return the size of this piece in bits.
-  uint64_t getBitPieceSize() const;
-
-  typedef ArrayRef<uint64_t>::iterator element_iterator;
-  element_iterator elements_begin() const { return getElements().begin(); }
-  element_iterator elements_end() const { return getElements().end(); }
-
-  /// \brief A lightweight wrapper around an expression operand.
-  ///
-  /// TODO: Store arguments directly and change \a DIExpression to store a
-  /// range of these.
-  class ExprOperand {
-    const uint64_t *Op;
-
-  public:
-    explicit ExprOperand(const uint64_t *Op) : Op(Op) {}
-
-    const uint64_t *get() const { return Op; }
-
-    /// \brief Get the operand code.
-    uint64_t getOp() const { return *Op; }
-
-    /// \brief Get an argument to the operand.
-    ///
-    /// Never returns the operand itself.
-    uint64_t getArg(unsigned I) const { return Op[I + 1]; }
-
-    unsigned getNumArgs() const { return getSize() - 1; }
-
-    /// \brief Return the size of the operand.
-    ///
-    /// Return the number of elements in the operand (1 + args).
-    unsigned getSize() const;
-  };
-
-  /// \brief An iterator for expression operands.
-  class expr_op_iterator
-      : public std::iterator<std::input_iterator_tag, ExprOperand> {
-    ExprOperand Op;
-
-  public:
-    explicit expr_op_iterator(element_iterator I) : Op(I) {}
-
-    element_iterator getBase() const { return Op.get(); }
-    const ExprOperand &operator*() const { return Op; }
-    const ExprOperand *operator->() const { return &Op; }
-
-    expr_op_iterator &operator++() {
-      increment();
-      return *this;
-    }
-    expr_op_iterator operator++(int) {
-      expr_op_iterator T(*this);
-      increment();
-      return T;
-    }
-
-    /// \brief Get the next iterator.
-    ///
-    /// \a std::next() doesn't work because this is technically an
-    /// input_iterator, but it's a perfectly valid operation.  This is an
-    /// accessor to provide the same functionality.
-    expr_op_iterator getNext() const { return ++expr_op_iterator(*this); }
-
-    bool operator==(const expr_op_iterator &X) const {
-      return getBase() == X.getBase();
-    }
-    bool operator!=(const expr_op_iterator &X) const {
-      return getBase() != X.getBase();
-    }
-
-  private:
-    void increment() { Op = ExprOperand(getBase() + Op.getSize()); }
-  };
-
-  /// \brief Visit the elements via ExprOperand wrappers.
-  ///
-  /// These range iterators visit elements through \a ExprOperand wrappers.
-  /// This is not guaranteed to be a valid range unless \a isValid() gives \c
-  /// true.
-  ///
-  /// \pre \a isValid() gives \c true.
-  /// @{
-  expr_op_iterator expr_op_begin() const {
-    return expr_op_iterator(elements_begin());
-  }
-  expr_op_iterator expr_op_end() const {
-    return expr_op_iterator(elements_end());
-  }
-  /// @}
-
-  bool isValid() const;
-
-  static bool classof(const Metadata *MD) {
-    return MD->getMetadataID() == DIExpressionKind;
-  }
-
-  /// \brief Is the first element a DW_OP_deref?.
-  bool startsWithDeref() const {
-    return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
-  }
-};
-
 class DIObjCProperty : public DINode {
   friend class LLVMContextImpl;
   friend class MDNode;
index ebeb635..d49660b 100644 (file)
@@ -27,8 +27,9 @@
 
 namespace llvm {
 
-class Module;
 class Constant;
+class DIGlobalVariable;
+class Module;
 template <typename ValueSubClass> class SymbolTableListTraits;
 
 class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
@@ -165,6 +166,9 @@ public:
   /// drops not only the reference to the initializer but also to any metadata.
   void dropAllReferences();
 
+  void addDebugInfo(DIGlobalVariable *GV);
+  void getDebugInfo(SmallVectorImpl<DIGlobalVariable *> &GVs) const;
+
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const Value *V) {
     return V->getValueID() == Value::GlobalVariableVal;
index 5120b94..15327a1 100644 (file)
@@ -4201,7 +4201,7 @@ bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
   OPTIONAL(type, MDField, );                                                   \
   OPTIONAL(isLocal, MDBoolField, );                                            \
   OPTIONAL(isDefinition, MDBoolField, (true));                                 \
-  OPTIONAL(variable, MDConstant, );                                            \
+  OPTIONAL(expr, MDField, );                                                   \
   OPTIONAL(declaration, MDField, );
   PARSE_MD_FIELDS();
 #undef VISIT_MD_FIELDS
@@ -4209,7 +4209,7 @@ bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
   Result = GET_OR_DISTINCT(DIGlobalVariable,
                            (Context, scope.Val, name.Val, linkageName.Val,
                             file.Val, line.Val, type.Val, isLocal.Val,
-                            isDefinition.Val, variable.Val, declaration.Val));
+                            isDefinition.Val, expr.Val, declaration.Val));
   return false;
 }
 
index db82766..2504ce7 100644 (file)
@@ -2679,14 +2679,35 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
         return error("Invalid record");
 
       IsDistinct = Record[0];
-      MetadataList.assignValue(
-          GET_OR_DISTINCT(DIGlobalVariable,
-                          (Context, getMDOrNull(Record[1]),
-                           getMDString(Record[2]), getMDString(Record[3]),
-                           getMDOrNull(Record[4]), Record[5],
-                           getDITypeRefOrNull(Record[6]), Record[7], Record[8],
-                           getMDOrNull(Record[9]), getMDOrNull(Record[10]))),
-          NextMetadataNo++);
+
+      // Upgrade old metadata, which stored a global variable reference or a
+      // ConstantInt here.
+      Metadata *Expr = getMDOrNull(Record[9]);
+      GlobalVariable *Attach = nullptr;
+      if (auto *CMD = dyn_cast_or_null<ConstantAsMetadata>(Expr)) {
+        if (auto *GV = dyn_cast<GlobalVariable>(CMD->getValue())) {
+          Attach = GV;
+          Expr = nullptr;
+        } else if (auto *CI = dyn_cast<ConstantInt>(CMD->getValue())) {
+          Expr = DIExpression::get(Context,
+                                   {dwarf::DW_OP_constu, CI->getZExtValue(),
+                                    dwarf::DW_OP_stack_value});
+        } else {
+          Expr = nullptr;
+        }
+      }
+
+      DIGlobalVariable *DGV = GET_OR_DISTINCT(
+          DIGlobalVariable,
+          (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
+           getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
+           getDITypeRefOrNull(Record[6]), Record[7], Record[8], Expr,
+           getMDOrNull(Record[10])));
+      MetadataList.assignValue(DGV, NextMetadataNo++);
+
+      if (Attach)
+        Attach->addDebugInfo(DGV);
+
       break;
     }
     case bitc::METADATA_LOCAL_VAR: {
index 391adeb..da6a891 100644 (file)
@@ -1710,7 +1710,7 @@ void ModuleBitcodeWriter::writeDIGlobalVariable(
   Record.push_back(VE.getMetadataOrNullID(N->getType()));
   Record.push_back(N->isLocalToUnit());
   Record.push_back(N->isDefinition());
-  Record.push_back(VE.getMetadataOrNullID(N->getRawVariable()));
+  Record.push_back(VE.getMetadataOrNullID(N->getRawExpr()));
   Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));
 
   Stream.EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);
index 017fc20..91a480e 100644 (file)
@@ -2001,6 +2001,14 @@ void CodeViewDebug::emitDebugInfoForUDTs(
 }
 
 void CodeViewDebug::emitDebugInfoForGlobals() {
+  DenseMap<const DIGlobalVariable *, const GlobalVariable *> GlobalMap;
+  for (const GlobalVariable &GV : MMI->getModule()->globals()) {
+    SmallVector<MDNode *, 1> MDs;
+    GV.getMetadata(LLVMContext::MD_dbg, MDs);
+    for (MDNode *MD : MDs)
+      GlobalMap[cast<DIGlobalVariable>(MD)] = &GV;
+  }
+
   NamedMDNode *CUs = MMI->getModule()->getNamedMetadata("llvm.dbg.cu");
   for (const MDNode *Node : CUs->operands()) {
     const auto *CU = cast<DICompileUnit>(Node);
@@ -2011,15 +2019,14 @@ void CodeViewDebug::emitDebugInfoForGlobals() {
     switchToDebugSectionForSymbol(nullptr);
     MCSymbol *EndLabel = nullptr;
     for (const DIGlobalVariable *G : CU->getGlobalVariables()) {
-      if (const auto *GV = dyn_cast_or_null<GlobalVariable>(G->getVariable())) {
+      if (const auto *GV = GlobalMap.lookup(G))
         if (!GV->hasComdat() && !GV->isDeclarationForLinker()) {
           if (!EndLabel) {
             OS.AddComment("Symbol subsection for globals");
             EndLabel = beginCVSubsection(ModuleSubstreamKind::Symbols);
           }
-          emitDebugInfoForGlobal(G, Asm->getSymbol(GV));
+          emitDebugInfoForGlobal(G, GV, Asm->getSymbol(GV));
         }
-      }
     }
     if (EndLabel)
       endCVSubsection(EndLabel);
@@ -2027,14 +2034,14 @@ void CodeViewDebug::emitDebugInfoForGlobals() {
     // Second, emit each global that is in a comdat into its own .debug$S
     // section along with its own symbol substream.
     for (const DIGlobalVariable *G : CU->getGlobalVariables()) {
-      if (const auto *GV = dyn_cast_or_null<GlobalVariable>(G->getVariable())) {
+      if (const auto *GV = GlobalMap.lookup(G)) {
         if (GV->hasComdat()) {
           MCSymbol *GVSym = Asm->getSymbol(GV);
           OS.AddComment("Symbol subsection for " +
                         Twine(GlobalValue::getRealLinkageName(GV->getName())));
           switchToDebugSectionForSymbol(GVSym);
           EndLabel = beginCVSubsection(ModuleSubstreamKind::Symbols);
-          emitDebugInfoForGlobal(G, GVSym);
+          emitDebugInfoForGlobal(G, GV, GVSym);
           endCVSubsection(EndLabel);
         }
       }
@@ -2055,6 +2062,7 @@ void CodeViewDebug::emitDebugInfoForRetainedTypes() {
 }
 
 void CodeViewDebug::emitDebugInfoForGlobal(const DIGlobalVariable *DIGV,
+                                           const GlobalVariable *GV,
                                            MCSymbol *GVSym) {
   // DataSym record, see SymbolRecord.h for more info.
   // FIXME: Thread local data, etc
@@ -2063,7 +2071,6 @@ void CodeViewDebug::emitDebugInfoForGlobal(const DIGlobalVariable *DIGV,
   OS.AddComment("Record length");
   OS.emitAbsoluteSymbolDiff(DataEnd, DataBegin, 2);
   OS.EmitLabel(DataBegin);
-  const auto *GV = cast<GlobalVariable>(DIGV->getVariable());
   if (DIGV->isLocalToUnit()) {
     if (GV->isThreadLocal()) {
       OS.AddComment("Record kind: S_LTHREAD32");
index 729012b..0149af5 100644 (file)
@@ -202,7 +202,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
   void emitDebugInfoForUDTs(
       ArrayRef<std::pair<std::string, codeview::TypeIndex>> UDTs);
 
-  void emitDebugInfoForGlobal(const DIGlobalVariable *DIGV, MCSymbol *GVSym);
+  void emitDebugInfoForGlobal(const DIGlobalVariable *DIGV,
+                              const GlobalVariable *GV, MCSymbol *GVSym);
 
   /// Opens a subsection of the given kind in a .debug$S codeview section.
   /// Returns an end label for use with endCVSubsection when the subsection is
index 7822814..f9030d1 100644 (file)
@@ -73,36 +73,9 @@ unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName,
       Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID());
 }
 
-// Return const expression if value is a GEP to access merged global
-// constant. e.g.
-// i8* getelementptr ({ i8, i8, i8, i8 }* @_MergedGlobals, i32 0, i32 0)
-static const ConstantExpr *getMergedGlobalExpr(const Value *V) {
-  const ConstantExpr *CE = dyn_cast_or_null<ConstantExpr>(V);
-  if (!CE || CE->getNumOperands() != 3 ||
-      CE->getOpcode() != Instruction::GetElementPtr)
-    return nullptr;
-
-  // First operand points to a global struct.
-  Value *Ptr = CE->getOperand(0);
-  GlobalValue *GV = dyn_cast<GlobalValue>(Ptr);
-  if (!GV || !isa<StructType>(GV->getValueType()))
-    return nullptr;
-
-  // Second operand is zero.
-  const ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CE->getOperand(1));
-  if (!CI || !CI->isZero())
-    return nullptr;
-
-  // Third operand is offset.
-  if (!isa<ConstantInt>(CE->getOperand(2)))
-    return nullptr;
-
-  return CE;
-}
-
 /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
 DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
-    const DIGlobalVariable *GV) {
+    const DIGlobalVariable *GV, const GlobalVariable *Global) {
   // Check for pre-existence.
   if (DIE *Die = getDIE(GV))
     return Die;
@@ -147,12 +120,22 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
 
   // Add location.
   bool addToAccelTable = false;
-  if (auto *Global = dyn_cast_or_null<GlobalVariable>(GV->getVariable())) {
+
+  DIExpression *Expr = GV->getExpr();
+
+  // For compatibility with DWARF 3 and earlier,
+  // DW_AT_location(DW_OP_constu, X, DW_OP_stack_value) becomes
+  // DW_AT_const_value(X).
+  if (Expr && Expr->getNumElements() == 3 &&
+      Expr->getElement(0) == dwarf::DW_OP_constu &&
+      Expr->getElement(2) == dwarf::DW_OP_stack_value) {
+    addConstantValue(*VariableDIE, /*Unsigned=*/true, Expr->getElement(1));
     // We cannot describe the location of dllimport'd variables: the computation
     // of their address requires loads from the IAT.
-    if (!Global->hasDLLImportStorageClass()) {
+  } else if (!Global || !Global->hasDLLImportStorageClass()) {
+    DIELoc *Loc = new (DIEValueAllocator) DIELoc;
+    if (Global) {
       addToAccelTable = true;
-      DIELoc *Loc = new (DIEValueAllocator) DIELoc;
       const MCSymbol *Sym = Asm->getSymbol(Global);
       if (Global->isThreadLocal()) {
         if (Asm->TM.Options.EmulatedTLS) {
@@ -187,30 +170,16 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
         addOpAddress(*Loc, Sym);
       }
 
-      addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
-      if (DD->useAllLinkageNames())
-        addLinkageName(*VariableDIE, GV->getLinkageName());
-    }
-  } else if (const ConstantInt *CI =
-                 dyn_cast_or_null<ConstantInt>(GV->getVariable())) {
-    addConstantValue(*VariableDIE, CI, GTy);
-  } else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getVariable())) {
-    auto *Ptr = cast<GlobalValue>(CE->getOperand(0));
-    if (!Ptr->hasDLLImportStorageClass()) {
-      addToAccelTable = true;
-      // GV is a merged global.
-      DIELoc *Loc = new (DIEValueAllocator) DIELoc;
-      MCSymbol *Sym = Asm->getSymbol(Ptr);
-      DD->addArangeLabel(SymbolCU(this, Sym));
-      addOpAddress(*Loc, Sym);
-      addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
-      SmallVector<Value *, 3> Idx(CE->op_begin() + 1, CE->op_end());
-      addUInt(*Loc, dwarf::DW_FORM_udata,
-              Asm->getDataLayout().getIndexedOffsetInType(Ptr->getValueType(),
-                                                          Idx));
-      addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
-      addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
+      if (Expr) {
+        DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
+        DwarfExpr.AddExpression(Expr->expr_op_begin(), Expr->expr_op_end());
+      }
     }
+
+    addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
+
+    if (DD->useAllLinkageNames())
+      addLinkageName(*VariableDIE, GV->getLinkageName());
   }
 
   if (addToAccelTable) {
@@ -674,7 +643,7 @@ DIE *DwarfCompileUnit::constructImportedEntityDIE(
   else if (auto *T = dyn_cast<DIType>(Entity))
     EntityDie = getOrCreateTypeDIE(T);
   else if (auto *GV = dyn_cast<DIGlobalVariable>(Entity))
-    EntityDie = getOrCreateGlobalVariableDIE(GV);
+    EntityDie = getOrCreateGlobalVariableDIE(GV, nullptr);
   else
     EntityDie = getDIE(Entity);
   assert(EntityDie);
index 90f74a3..766da4a 100644 (file)
@@ -97,7 +97,8 @@ public:
   void applyStmtList(DIE &D);
 
   /// getOrCreateGlobalVariableDIE - get or create global variable DIE.
-  DIE *getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV);
+  DIE *getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV,
+                                    const GlobalVariable *Global);
 
   /// addLabelAddress - Add a dwarf label attribute data and value using
   /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
index 3077822..d9c7c2b 100644 (file)
@@ -477,12 +477,20 @@ void DwarfDebug::beginModule() {
   MMI->setDebugInfoAvailability(NumDebugCUs > 0);
   SingleCU = NumDebugCUs == 1;
 
+  DenseMap<DIGlobalVariable *, const GlobalVariable *> GVMap;
+  for (const GlobalVariable &Global : M->globals()) {
+    SmallVector<DIGlobalVariable *, 1> GVs;
+    Global.getDebugInfo(GVs);
+    for (auto &GV : GVs)
+      GVMap[GV] = &Global;
+  }
+
   for (DICompileUnit *CUNode : M->debug_compile_units()) {
     DwarfCompileUnit &CU = constructDwarfCompileUnit(CUNode);
     for (auto *IE : CUNode->getImportedEntities())
       CU.addImportedEntity(IE);
     for (auto *GV : CUNode->getGlobalVariables())
-      CU.getOrCreateGlobalVariableDIE(GV);
+      CU.getOrCreateGlobalVariableDIE(GV, GVMap.lookup(GV));
     for (auto *Ty : CUNode->getEnumTypes()) {
       // The enum types array by design contains pointers to
       // MDNodes rather than DIRefs. Unique them here.
index 7dbc6cb..d3e63e3 100644 (file)
@@ -278,6 +278,13 @@ void DwarfExpression::AddExpression(DIExpression::expr_op_iterator I,
     case dwarf::DW_OP_deref:
       EmitOp(dwarf::DW_OP_deref);
       break;
+    case dwarf::DW_OP_constu:
+      EmitOp(dwarf::DW_OP_constu);
+      EmitUnsigned(I->getArg(0));
+      break;
+    case dwarf::DW_OP_stack_value:
+      AddStackValue();
+      break;
     default:
       llvm_unreachable("unhandled opcode found in expression");
     }
index 8c760b7..de39e96 100644 (file)
@@ -451,10 +451,16 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals,
         M, MergedTy, isConst, GlobalValue::PrivateLinkage, MergedInit,
         "_MergedGlobals", nullptr, GlobalVariable::NotThreadLocal, AddrSpace);
 
+    const StructLayout *MergedLayout = DL.getStructLayout(MergedTy);
+
     for (ssize_t k = i, idx = 0; k != j; k = GlobalSet.find_next(k), ++idx) {
       GlobalValue::LinkageTypes Linkage = Globals[k]->getLinkage();
       std::string Name = Globals[k]->getName();
 
+      // Copy metadata while adjusting any debug info metadata by the original
+      // global's offset within the merged global.
+      MergedGV->copyMetadata(Globals[k], MergedLayout->getElementOffset(idx));
+
       Constant *Idx[2] = {
         ConstantInt::get(Int32Ty, 0),
         ConstantInt::get(Int32Ty, idx),
index bcb5f19..0734a37 100644 (file)
@@ -1816,7 +1816,7 @@ static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N,
   Printer.printMetadata("type", N->getRawType());
   Printer.printBool("isLocal", N->isLocalToUnit());
   Printer.printBool("isDefinition", N->isDefinition());
-  Printer.printMetadata("variable", N->getRawVariable());
+  Printer.printMetadata("expr", N->getExpr());
   Printer.printMetadata("declaration", N->getRawStaticDataMemberDeclaration());
   Out << ")";
 }
index 21cedee..1adf928 100644 (file)
@@ -535,13 +535,13 @@ static void checkGlobalVariableScope(DIScope *Context) {
 
 DIGlobalVariable *DIBuilder::createGlobalVariable(
     DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
-    unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val,
+    unsigned LineNumber, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
     MDNode *Decl) {
   checkGlobalVariableScope(Context);
 
   auto *N = DIGlobalVariable::getDistinct(
       VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
-      LineNumber, Ty, isLocalToUnit, true, Val,
+      LineNumber, Ty, isLocalToUnit, true, Expr,
       cast_or_null<DIDerivedType>(Decl));
   AllGVs.push_back(N);
   return N;
@@ -549,13 +549,13 @@ DIGlobalVariable *DIBuilder::createGlobalVariable(
 
 DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
     DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
-    unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val,
+    unsigned LineNumber, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
     MDNode *Decl) {
   checkGlobalVariableScope(Context);
 
   return DIGlobalVariable::getTemporary(
              VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
-             LineNumber, Ty, isLocalToUnit, false, Val,
+             LineNumber, Ty, isLocalToUnit, false, Expr,
              cast_or_null<DIDerivedType>(Decl))
       .release();
 }
index 208fa9b..74f8ce8 100644 (file)
@@ -551,6 +551,7 @@ unsigned DIExpression::ExprOperand::getSize() const {
   switch (getOp()) {
   case dwarf::DW_OP_bit_piece:
     return 3;
+  case dwarf::DW_OP_constu:
   case dwarf::DW_OP_plus:
   case dwarf::DW_OP_minus:
     return 2;
@@ -570,8 +571,11 @@ bool DIExpression::isValid() const {
     default:
       return false;
     case dwarf::DW_OP_bit_piece:
-      // Piece expressions must be at the end.
+    case dwarf::DW_OP_stack_value:
+      // We only support bit piece and stack value expressions which appear at
+      // the end.
       return I->get() + I->getSize() == E->get();
+    case dwarf::DW_OP_constu:
     case dwarf::DW_OP_plus:
     case dwarf::DW_OP_minus:
     case dwarf::DW_OP_deref:
index 1d0b1b1..40935d9 100644 (file)
@@ -758,23 +758,23 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
   Metadata *Type;
   bool IsLocalToUnit;
   bool IsDefinition;
-  Metadata *Variable;
+  Metadata *Expr;
   Metadata *StaticDataMemberDeclaration;
 
   MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
                 Metadata *File, unsigned Line, Metadata *Type,
-                bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
+                bool IsLocalToUnit, bool IsDefinition, Metadata *Expr,
                 Metadata *StaticDataMemberDeclaration)
       : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
         Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
-        IsDefinition(IsDefinition), Variable(Variable),
+        IsDefinition(IsDefinition), Expr(Expr),
         StaticDataMemberDeclaration(StaticDataMemberDeclaration) {}
   MDNodeKeyImpl(const DIGlobalVariable *N)
       : Scope(N->getRawScope()), Name(N->getRawName()),
         LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
         Line(N->getLine()), Type(N->getRawType()),
         IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
-        Variable(N->getRawVariable()),
+        Expr(N->getRawExpr()),
         StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {}
 
   bool isKeyOf(const DIGlobalVariable *RHS) const {
@@ -783,13 +783,13 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
            File == RHS->getRawFile() && Line == RHS->getLine() &&
            Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
            IsDefinition == RHS->isDefinition() &&
-           Variable == RHS->getRawVariable() &&
+           Expr == RHS->getRawExpr() &&
            StaticDataMemberDeclaration ==
                RHS->getRawStaticDataMemberDeclaration();
   }
   unsigned getHashValue() const {
     return hash_combine(Scope, Name, LinkageName, File, Line, Type,
-                        IsLocalToUnit, IsDefinition, Variable,
+                        IsLocalToUnit, IsDefinition, Expr,
                         StaticDataMemberDeclaration);
   }
 };
index ad95bff..223326b 100644 (file)
@@ -1424,6 +1424,21 @@ void GlobalObject::copyMetadata(const GlobalObject *Other, unsigned Offset) {
                   *MDNode::get(getContext(), {NewOffsetMD, TypeId}));
       continue;
     }
+    // If an offset adjustment was specified we need to modify the DIExpression
+    // to prepend the adjustment:
+    // !DIExpression(DW_OP_plus, Offset, [original expr])
+    if (Offset != 0 && MD.first == LLVMContext::MD_dbg) {
+      DIGlobalVariable *GV = cast<DIGlobalVariable>(MD.second);
+      DIExpression *E = GV->getExpr();
+      ArrayRef<uint64_t> OrigElements;
+      if (E)
+        OrigElements = E->getElements();
+      std::vector<uint64_t> Elements(OrigElements.size() + 2);
+      Elements[0] = dwarf::DW_OP_plus;
+      Elements[1] = Offset;
+      std::copy(OrigElements.begin(), OrigElements.end(), Elements.begin() + 2);
+      GV->replaceExpr(DIExpression::get(getContext(), Elements));
+    }
     addMetadata(MD.first, *MD.second);
   }
 }
@@ -1444,3 +1459,15 @@ void Function::setSubprogram(DISubprogram *SP) {
 DISubprogram *Function::getSubprogram() const {
   return cast_or_null<DISubprogram>(getMetadata(LLVMContext::MD_dbg));
 }
+
+void GlobalVariable::addDebugInfo(DIGlobalVariable *GV) {
+  addMetadata(LLVMContext::MD_dbg, *GV);
+}
+
+void GlobalVariable::getDebugInfo(
+    SmallVectorImpl<DIGlobalVariable *> &GVs) const {
+  SmallVector<MDNode *, 1> MDs;
+  getMetadata(LLVMContext::MD_dbg, MDs);
+  for (MDNode *MD : MDs)
+    GVs.push_back(cast<DIGlobalVariable>(MD));
+}
index ba7db85..32ead4f 100644 (file)
@@ -1112,12 +1112,8 @@ void Verifier::visitDIGlobalVariable(const DIGlobalVariable &N) {
 
   AssertDI(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
   AssertDI(!N.getName().empty(), "missing global variable name", &N);
-  if (auto *V = N.getRawVariable()) {
-    AssertDI(isa<ConstantAsMetadata>(V) &&
-                 !isa<Function>(cast<ConstantAsMetadata>(V)->getValue()),
-             "invalid global variable ref", &N, V);
-    visitConstantExprsRecursively(cast<ConstantAsMetadata>(V)->getValue());
-  }
+  if (auto *V = N.getRawExpr())
+    AssertDI(isa<DIExpression>(V), "invalid expression location", &N, V);
   if (auto *Member = N.getRawStaticDataMemberDeclaration()) {
     AssertDI(isa<DIDerivedType>(Member),
              "invalid static data member declaration", &N, Member);
index c02abd7..5a00aae 100644 (file)
@@ -465,7 +465,7 @@ class IRLinker {
 
   Error linkModuleFlagsMetadata();
 
-  void linkGlobalInit(GlobalVariable &Dst, GlobalVariable &Src);
+  void linkGlobalVariable(GlobalVariable &Dst, GlobalVariable &Src);
   Error linkFunctionBody(Function &Dst, Function &Src);
   void linkAliasBody(GlobalAlias &Dst, GlobalAlias &Src);
   Error linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src);
@@ -942,7 +942,9 @@ Expected<Constant *> IRLinker::linkGlobalValueProto(GlobalValue *SGV,
 
 /// Update the initializers in the Dest module now that all globals that may be
 /// referenced are in Dest.
-void IRLinker::linkGlobalInit(GlobalVariable &Dst, GlobalVariable &Src) {
+void IRLinker::linkGlobalVariable(GlobalVariable &Dst, GlobalVariable &Src) {
+  Dst.copyMetadata(&Src, 0);
+
   // Figure out what the initializer looks like in the dest module.
   Mapper.scheduleMapGlobalInitializer(Dst, *Src.getInitializer());
 }
@@ -985,7 +987,7 @@ Error IRLinker::linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src) {
   if (auto *F = dyn_cast<Function>(&Src))
     return linkFunctionBody(cast<Function>(Dst), *F);
   if (auto *GVar = dyn_cast<GlobalVariable>(&Src)) {
-    linkGlobalInit(cast<GlobalVariable>(Dst), *GVar);
+    linkGlobalVariable(cast<GlobalVariable>(Dst), *GVar);
     return Error::success();
   }
   linkAliasBody(cast<GlobalAlias>(Dst), cast<GlobalAlias>(Src));
index fd25036..51c2103 100644 (file)
@@ -312,13 +312,14 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
   // replace the current list of potentially dead global variables/functions
   // with the live list.
   SmallVector<Metadata *, 64> LiveGlobalVariables;
-  SmallVector<Metadata *, 64> LiveSubprograms;
   DenseSet<const MDNode *> VisitedSet;
 
-  std::set<DISubprogram *> LiveSPs;
-  for (Function &F : M) {
-    if (DISubprogram *SP = F.getSubprogram())
-      LiveSPs.insert(SP);
+  std::set<DIGlobalVariable *> LiveGVs;
+  for (GlobalVariable &GV : M.globals()) {
+    SmallVector<DIGlobalVariable *, 1> DIs;
+    GV.getDebugInfo(DIs);
+    for (DIGlobalVariable *DI : DIs)
+      LiveGVs.insert(DI);
   }
 
   for (DICompileUnit *DIC : F.compile_units()) {
@@ -329,9 +330,8 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
       if (!VisitedSet.insert(DIG).second)
         continue;
 
-      // If the global variable referenced by DIG is not null, the global
-      // variable is live.
-      if (DIG->getVariable())
+      // If a global variable references DIG, the global variable is live.
+      if (LiveGVs.count(DIG))
         LiveGlobalVariables.push_back(DIG);
       else
         GlobalVariableChange = true;
@@ -345,7 +345,6 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
     }
 
     // Reset lists for the next iteration.
-    LiveSubprograms.clear();
     LiveGlobalVariables.clear();
   }
 
index 0d027d3..afaa5f8 100644 (file)
@@ -3,7 +3,7 @@
 
 @foo = global i32 0
 
-; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
+; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !8, !9, !10}
 !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
 
 !0 = !DIFile(filename: "scope.h", directory: "/path/to/dir")
 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !4 = distinct !{}
 
-; CHECK: !5 = !DIGlobalVariable(name: "foo", linkageName: "foo", scope: !0, file: !2, line: 7, type: !3, isLocal: true, isDefinition: false, variable: i32* @foo)
+; CHECK: !5 = !DIGlobalVariable(name: "foo", linkageName: "foo", scope: !0, file: !2, line: 7, type: !3, isLocal: true, isDefinition: false)
 !5 = !DIGlobalVariable(name: "foo", linkageName: "foo", scope: !0,
                        file: !2, line: 7, type: !3, isLocal: true,
-                       isDefinition: false, variable: i32* @foo)
+                       isDefinition: false)
 
-; CHECK: !6 = !DIGlobalVariable(name: "foo", scope: !0, isLocal: false, isDefinition: true)
-!6 = !DIGlobalVariable(name: "foo", scope: !0)
+; CHECK: !6 = !DIGlobalVariable(name: "foo", scope: !0, isLocal: false, isDefinition: true, expr: !7)
+; CHECK: !7 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value)
+!6 = !DIGlobalVariable(name: "foo", scope: !0, expr: !DIExpression(DW_OP_constu, 42, DW_OP_stack_value))
 
 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "Class", size: 8, align: 8)
 !8 = !DIDerivedType(tag: DW_TAG_member, name: "mem", flags: DIFlagStaticMember, scope: !7, baseType: !3)
 
-; CHECK: !9 = !DIGlobalVariable(name: "mem", scope: !0, isLocal: false, isDefinition: true, declaration: !8)
+; CHECK: !10 = !DIGlobalVariable(name: "mem", scope: !0, isLocal: false, isDefinition: true, declaration: !9)
 !9 = !DIGlobalVariable(name: "mem", scope: !0, declaration: !8)
diff --git a/llvm/test/Bitcode/diglobalvariable-3.8.ll b/llvm/test/Bitcode/diglobalvariable-3.8.ll
new file mode 100644 (file)
index 0000000..55b3f65
--- /dev/null
@@ -0,0 +1,8 @@
+; RUN: llvm-dis -o - %s.bc | FileCheck %s
+
+; CHECK: !0 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false, isDefinition: true, expr: !1)
+; CHECK: !1 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value)
+
+!named = !{!0}
+
+!0 = distinct !DIGlobalVariable(name: "a", variable: i32 42)
diff --git a/llvm/test/Bitcode/diglobalvariable-3.8.ll.bc b/llvm/test/Bitcode/diglobalvariable-3.8.ll.bc
new file mode 100644 (file)
index 0000000..bfecedd
Binary files /dev/null and b/llvm/test/Bitcode/diglobalvariable-3.8.ll.bc differ
index 6c953f2..2bbe1a8 100644 (file)
@@ -4,20 +4,22 @@
 ; Establish a stable order.
 !named = !{!0, !1, !2, !3, !4, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16}
 
-; CHECK:      !0 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
+; CHECK: @G1 = global i32 0, !dbg !0
+
+; CHECK:      !0 = !DIGlobalVariable(name: "G",{{.*}} type: !1,
 ; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_structure_type, name: "T1"{{.*}}, identifier: "T1")
-; CHECK-NEXT: !2 = !DICompositeType(tag: DW_TAG_structure_type, name: "T2", scope: !1{{.*}}, baseType: !1, vtableHolder: !1, identifier: "T2")
-; CHECK-NEXT: !3 = !DIDerivedType(tag: DW_TAG_member, name: "M1", scope: !1{{.*}}, baseType: !2)
-; CHECK-NEXT: !4 = !DISubroutineType(types: !5)
-; CHECK-NEXT: !5 = !{!1, !2}
-; CHECK-NEXT: !6 = !DISubprogram(scope: !1,{{.*}} containingType: !1{{[,)]}}
-; CHECK-NEXT: !7 = !DILocalVariable(name: "V1", scope: !6, type: !2)
-; CHECK-NEXT: !8 = !DIObjCProperty(name: "P1", type: !1)
-; CHECK-NEXT: !9 = !DITemplateTypeParameter(type: !1)
-; CHECK-NEXT: !10 = !DIGlobalVariable(name: "G",{{.*}} type: !1,{{.*}} variable: i32* @G1)
+; CHECK-NEXT: !2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
+; CHECK-NEXT: !3 = !DICompositeType(tag: DW_TAG_structure_type, name: "T2", scope: !1{{.*}}, baseType: !1, vtableHolder: !1, identifier: "T2")
+; CHECK-NEXT: !4 = !DIDerivedType(tag: DW_TAG_member, name: "M1", scope: !1{{.*}}, baseType: !3)
+; CHECK-NEXT: !5 = !DISubroutineType(types: !6)
+; CHECK-NEXT: !6 = !{!1, !3}
+; CHECK-NEXT: !7 = !DISubprogram(scope: !1,{{.*}} containingType: !1{{[,)]}}
+; CHECK-NEXT: !8 = !DILocalVariable(name: "V1", scope: !7, type: !3)
+; CHECK-NEXT: !9 = !DIObjCProperty(name: "P1", type: !1)
+; CHECK-NEXT: !10 = !DITemplateTypeParameter(type: !1)
 ; CHECK-NEXT: !11 = !DITemplateValueParameter(type: !1, value: i32* @G1)
-; CHECK-NEXT: !12 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "T2", scope: !0, entity: !1)
-; CHECK-NEXT: !13 = !DICompositeType(tag: DW_TAG_structure_type, name: "T3", file: !0, elements: !14, identifier: "T3")
+; CHECK-NEXT: !12 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "T2", scope: !2, entity: !1)
+; CHECK-NEXT: !13 = !DICompositeType(tag: DW_TAG_structure_type, name: "T3", file: !2, elements: !14, identifier: "T3")
 ; CHECK-NEXT: !14 = !{!15}
 ; CHECK-NEXT: !15 = !DISubprogram(scope: !13,
 ; CHECK-NEXT: !16 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type,{{.*}} extraData: !13)
index 5ae1b66..7a202dd 100644 (file)
@@ -3,7 +3,7 @@
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
 target triple = "thumbv7-apple-darwin3.0.0-iphoneos"
 
-@length = common global i32 0, align 4            ; <i32*> [#uses=1]
+@length = common global i32 0, align 4, !dbg !14            ; <i32*> [#uses=1]
 
 define void @x0(i8* nocapture %buf, i32 %nbytes) nounwind optsize {
 entry:
@@ -60,7 +60,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
 !11 = distinct !DILexicalBlock(line: 5, column: 1, file: !26, scope: !1)
 !12 = !DILocalVariable(name: "c", line: 7, scope: !11, file: !2, type: !13)
 !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!14 = !DIGlobalVariable(name: "length", linkageName: "length", line: 1, isLocal: false, isDefinition: true, scope: !2, file: !2, type: !13, variable: i32* @length)
+!14 = !DIGlobalVariable(name: "length", linkageName: "length", line: 1, isLocal: false, isDefinition: true, scope: !2, file: !2, type: !13)
 !15 = !DILocation(line: 4, column: 24, scope: !1)
 !16 = !DILocation(line: 4, column: 43, scope: !1)
 !17 = !DILocation(line: 9, column: 2, scope: !11)
index 8c6cf00..1dce3d2 100644 (file)
@@ -3,11 +3,11 @@
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
 target triple = "thumbv7-apple-darwin10"
 
-@x1 = internal global i8 1, align 1
-@x2 = internal global i8 1, align 1
-@x3 = internal global i8 1, align 1
-@x4 = internal global i8 1, align 1
-@x5 = global i8 1, align 1
+@x1 = internal global i8 1, align 1, !dbg !13
+@x2 = internal global i8 1, align 1, !dbg !14
+@x3 = internal global i8 1, align 1, !dbg !15
+@x4 = internal global i8 1, align 1, !dbg !16
+@x5 = global i8 1, align 1, !dbg !17
 
 ; Check debug info output for merged global.
 ; DW_AT_location
@@ -21,12 +21,12 @@ target triple = "thumbv7-apple-darwin10"
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x1"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x8> 03 [[ADDR:.. .. .. ..]] 10 00 22  )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x5> 03 [[ADDR:.. .. .. ..]]   )
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x2"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x8> 03 [[ADDR]] 10 01 22  )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x7> 03 [[ADDR]] 23 01  )
 
 define zeroext i8 @get1(i8 zeroext %a) nounwind optsize !dbg !0 {
 entry:
@@ -91,11 +91,11 @@ entry:
 !10 = !DILocalVariable(name: "a", line: 4, arg: 1, scope: !0, file: !1, type: !5)
 !11 = !DILocalVariable(name: "b", line: 4, scope: !12, file: !1, type: !5)
 !12 = distinct !DILexicalBlock(line: 4, column: 0, file: !47, scope: !0)
-!13 = !DIGlobalVariable(name: "x1", line: 3, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5, variable: i8* @x1)
-!14 = !DIGlobalVariable(name: "x2", line: 6, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5, variable: i8* @x2)
-!15 = !DIGlobalVariable(name: "x3", line: 9, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5, variable: i8* @x3)
-!16 = !DIGlobalVariable(name: "x4", line: 12, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5, variable: i8* @x4)
-!17 = !DIGlobalVariable(name: "x5", line: 15, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5, variable: i8* @x5)
+!13 = !DIGlobalVariable(name: "x1", line: 3, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5)
+!14 = !DIGlobalVariable(name: "x2", line: 6, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5)
+!15 = !DIGlobalVariable(name: "x3", line: 9, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5)
+!16 = !DIGlobalVariable(name: "x4", line: 12, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !5)
+!17 = !DIGlobalVariable(name: "x5", line: 15, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5)
 !18 = !DILocalVariable(name: "a", line: 7, arg: 1, scope: !6, file: !1, type: !5)
 !19 = !DILocalVariable(name: "b", line: 7, scope: !20, file: !1, type: !5)
 !20 = distinct !DILexicalBlock(line: 7, column: 0, file: !47, scope: !6)
index 4da4fd4..1303aa1 100644 (file)
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x1"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x8> 03 [[ADDR:.. .. .. ..]] 10 00 22  )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x5> 03 [[ADDR:.. .. .. ..]]   )
 ; CHECK: DW_TAG_variable
 ; CHECK-NOT: DW_TAG
 ; CHECK:    DW_AT_name {{.*}} "x2"
 ; CHECK-NOT: {{DW_TAG|NULL}}
-; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x8> 03 [[ADDR]] 10 04 22  )
+; CHECK:    DW_AT_location [DW_FORM_exprloc]        (<0x7> 03 [[ADDR]] 23 04  )
 
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
 target triple = "thumbv7-apple-macosx10.7.0"
 
-@x1 = internal unnamed_addr global i32 1, align 4
-@x2 = internal unnamed_addr global i32 2, align 4
+@x1 = internal unnamed_addr global i32 1, align 4, !dbg !25
+@x2 = internal unnamed_addr global i32 2, align 4, !dbg !26
 @x3 = internal unnamed_addr global i32 3, align 4
 @x4 = internal unnamed_addr global i32 4, align 4
 @x5 = global i32 0, align 4
@@ -95,8 +95,8 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
 !19 = !DILocalVariable(name: "a", line: 14, arg: 1, scope: !8, file: !2, type: !5)
 !20 = !DILocalVariable(name: "b", line: 14, scope: !21, file: !2, type: !5)
 !21 = distinct !DILexicalBlock(line: 14, column: 19, file: !47, scope: !8)
-!25 = !DIGlobalVariable(name: "x1", line: 4, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !5, variable: i32* @x1)
-!26 = !DIGlobalVariable(name: "x2", line: 7, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !5, variable: i32* @x2)
+!25 = !DIGlobalVariable(name: "x1", line: 4, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !5)
+!26 = !DIGlobalVariable(name: "x2", line: 7, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !5)
 !27 = !DILocalVariable(name: "a", line: 17, arg: 1, scope: !9, file: !2, type: !5)
 !28 = !DILocalVariable(name: "b", line: 17, scope: !29, file: !2, type: !5)
 !29 = distinct !DILexicalBlock(line: 17, column: 19, file: !47, scope: !9)
index cd45af3..bf718db 100644 (file)
@@ -9,10 +9,10 @@
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
 target triple = "thumbv7-apple-ios3.0.0"
 
-@c = common global i32 0, align 4
-@b = common global i32 0, align 4
-@a = common global i64 0, align 8
-@d = common global i32 0, align 4
+@c = common global i32 0, align 4, !dbg !19
+@b = common global i32 0, align 4, !dbg !18
+@a = common global i64 0, align 8, !dbg !16
+@d = common global i32 0, align 4, !dbg !20
 
 ; Function Attrs: nounwind ssp
 define i32 @pr16110() #0 !dbg !4 {
@@ -94,11 +94,11 @@ attributes #3 = { nounwind }
 !13 = distinct !DILexicalBlock(line: 12, column: 0, file: !1, scope: !4)
 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !8)
 !15 = !{!16, !18, !19, !20}
-!16 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !17, variable: i64* @a)
+!16 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !17)
 !17 = !DIBasicType(tag: DW_TAG_base_type, name: "long long int", size: 64, align: 32, encoding: DW_ATE_signed)
-!18 = !DIGlobalVariable(name: "b", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @b)
-!19 = !DIGlobalVariable(name: "c", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @c)
-!20 = !DIGlobalVariable(name: "d", line: 4, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @d)
+!18 = !DIGlobalVariable(name: "b", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8)
+!19 = !DIGlobalVariable(name: "c", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8)
+!20 = !DIGlobalVariable(name: "d", line: 4, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8)
 !21 = !DILocation(line: 10, scope: !22)
 !22 = distinct !DILexicalBlock(line: 10, column: 0, file: !1, scope: !4)
 !26 = !DILocation(line: 12, scope: !13)
index 4b33d27..623a2d8 100644 (file)
@@ -7,7 +7,7 @@ target triple = "nvptx64-nvidia-cuda"
 
 ; Generic space variables should be converted to global space AKA addrspace(1).
 ; CHECK-DAG: @static_var = {{.*}}addrspace(1)
-@static_var = externally_initialized global i8 0, align 1
+@static_var = externally_initialized global i8 0, align 1, !dbg !4
 ; CHECK-DAG: @.str = {{.*}}addrspace(1)
 @.str = private unnamed_addr constant [4 x i8] c"XXX\00", align 1
 
@@ -43,12 +43,11 @@ declare void @extfunc(i8 signext)
 ; Find list of global variables and make sure it's the one used by DICompileUnit
 ; CHECK: [[GLOBALSNODE]] = !{[[GVNODE:![0-9]+]]}
 !4 = distinct !DIGlobalVariable(name: "static_var", scope: !0, file: !1, line: 2, type: !5, isLocal: false,
-               isDefinition: true, variable: i8* @static_var)
+               isDefinition: true)
 ; Debug info must also be updated to reflect new address space.
 ; CHECK: [[GVNODE]] = distinct !DIGlobalVariable(name: "static_var"
 ; CHECK-SAME: scope: [[CUNODE]]
 ; CHECK-SAME: type: [[TYPENODE:![0-9]+]]
-; CHECK-SAME: variable: i8* addrspacecast (i8 addrspace(1)* @static_var to i8*)
 !5 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
 ; CHECK: [[TYPENODE]] = !DIBasicType(name: "char"
 !6 = !{i32 2, !"Dwarf Version", i32 4}
index 0dbdfb8..6d8e28c 100644 (file)
@@ -6,7 +6,7 @@
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
 
-@grid_points = external global [3 x i32], align 4
+@grid_points = external global [3 x i32], align 4, !dbg !299
 
 ; Function Attrs: nounwind
 define fastcc void @compute_rhs() #0 !dbg !114 {
@@ -352,7 +352,7 @@ attributes #1 = { nounwind readnone }
 !296 = !DILocalVariable(name: "j", line: 907, scope: !293, file: !5, type: !8)
 !297 = !DILocalVariable(name: "k", line: 907, scope: !293, file: !5, type: !8)
 !298 = !{!299, !304, !305, !309, !310, !311, !312, !313, !314, !315, !316, !317, !318, !319, !320, !321, !322, !323, !324, !325, !326, !327, !328, !329, !330, !331, !332, !333, !334, !335, !336, !337, !338, !339, !340, !341, !342, !343, !347, !350, !351, !352, !353, !354, !355, !356, !360, !361, !362, !363, !364, !365, !366, !367, !368, !369, !370, !371, !372, !373, !374, !375, !376, !377, !378, !379, !380, !381, !382, !383, !384, !385, !386, !387, !388, !389, !390, !391, !392, !393, !394, !395, !396, !397, !398, !399, !400, !401, !402, !403, !404, !405, !406, !407, !408, !409, !410, !411, !412, !413, !414, !415, !416, !417, !418, !419, !422, !426, !427, !430, !431, !434, !435, !436, !437}
-!299 = !DIGlobalVariable(name: "grid_points", line: 28, isLocal: true, isDefinition: true, scope: null, file: !300, type: !302, variable: [3 x i32]* @grid_points)
+!299 = !DIGlobalVariable(name: "grid_points", line: 28, isLocal: true, isDefinition: true, scope: null, file: !300, type: !302)
 !300 = !DIFile(filename: "./header.h", directory: "/home/hfinkel/src/NPB2.3-omp-C/BT")
 !301 = !{!"./header.h", !"/home/hfinkel/src/NPB2.3-omp-C/BT"}
 !302 = !DICompositeType(tag: DW_TAG_array_type, size: 96, align: 32, baseType: !8, elements: !303)
index 2f667cf..d7cd9e1 100644 (file)
@@ -3,7 +3,7 @@
 ; Verify that we no longer crash in VSX swap removal when debug values
 ; are in the code stream.
 
-@php_intpow10.powers = external unnamed_addr constant [23 x double], align 8
+@php_intpow10.powers = external unnamed_addr constant [23 x double], align 8, !dbg !24
 
 ; Function Attrs: nounwind
 define double @_php_math_round(double %value, i32 signext %places, i32 signext %mode) #0 !dbg !6 {
@@ -79,7 +79,7 @@ attributes #3 = { nounwind }
 !21 = !{!22}
 !22 = !DILocalVariable(name: "power", arg: 1, scope: !18, file: !1, line: 1, type: !9)
 !23 = !{!24}
-!24 = !DIGlobalVariable(name: "powers", scope: !18, file: !1, line: 3, type: !25, isLocal: true, isDefinition: true, variable: [23 x double]* @php_intpow10.powers)
+!24 = !DIGlobalVariable(name: "powers", scope: !18, file: !1, line: 3, type: !25, isLocal: true, isDefinition: true)
 !25 = !DICompositeType(tag: DW_TAG_array_type, baseType: !26, size: 1472, align: 64, elements: !27)
 !26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !4)
 !27 = !{!28}
index 874cc7c..60d335d 100644 (file)
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mcpu=generic -mtriple=i386-apple-darwin -no-integrated-as
 
-@g1 = global double 0.000000e+00, align 8
-@g2 = global i32 0, align 4
+@g1 = global double 0.000000e+00, align 8, !dbg !22
+@g2 = global i32 0, align 4, !dbg !23
 
 define void @_Z16fpuop_arithmeticjj(i32, i32) !dbg !4 {
 entry:
@@ -64,7 +64,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
 !19 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !20 = !DILocalVariable(name: "value", line: 16, scope: !4, file: !6, type: !14)
 !21 = !{!22, !23}
-!22 = !DIGlobalVariable(name: "g1", line: 5, isLocal: false, isDefinition: true, scope: null, file: !6, type: !14, variable: double* @g1)
-!23 = !DIGlobalVariable(name: "g2", line: 6, isLocal: false, isDefinition: true, scope: null, file: !6, type: !19, variable: i32* @g2)
+!22 = !DIGlobalVariable(name: "g1", line: 5, isLocal: false, isDefinition: true, scope: null, file: !6, type: !14)
+!23 = !DIGlobalVariable(name: "g2", line: 6, isLocal: false, isDefinition: true, scope: null, file: !6, type: !19)
 !24 = !{i32 2, !"Dwarf Version", i32 2}
 !25 = !{i32 2, !"Debug Info Version", i32 3}
index db218f4..1f91e3a 100644 (file)
@@ -22,7 +22,7 @@
 
 %class.C = type { i8 }
 
-@argc = global i8 0, align 1
+@argc = global i8 0, align 1, !dbg !21
 
 declare i32 @test_function(%class.C*, i8 signext, i8 signext, i8 signext, ...)
 
@@ -82,7 +82,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
 !18 = !DILocalVariable(name: "c", line: 7, scope: !13, file: !14, type: !4)
 !19 = !DILocalVariable(name: "lc", line: 8, scope: !13, file: !14, type: !11)
 !20 = !{!21}
-!21 = !DIGlobalVariable(name: "argc", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !11, variable: i8* @argc)
+!21 = !DIGlobalVariable(name: "argc", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !11)
 !22 = !{i32 2, !"Dwarf Version", i32 4}
 !23 = !{i32 2, !"Debug Info Version", i32 3}
 !25 = !DILocation(line: 8, column: 3, scope: !13)
index 78088c0..4fea2a6 100644 (file)
@@ -3,7 +3,7 @@
 target datalayout = "E-m:e-i64:64-i128:128-n32:64-S128"
 target triple = "aarch64_be--none-eabi"
 
-@a = common global i32 0, align 4
+@a = common global i32 0, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!8, !9}
@@ -13,7 +13,7 @@ target triple = "aarch64_be--none-eabi"
 !1 = !DIFile(filename: "-", directory: "/work/validation")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !7, variable: i32* @a)
+!4 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !7)
 !5 = !DIFile(filename: "<stdin>", directory: "/work/validation")
 !6 = !{!"<stdin>", !"/work/validation"}
 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
index f2af152..3e93823 100644 (file)
@@ -48,7 +48,7 @@ target triple = "aarch64_be--linux-gnu"
 
 %struct.bitfield = type <{ i8, [3 x i8], i64 }>
 
-@b = common global %struct.bitfield zeroinitializer, align 4
+@b = common global %struct.bitfield zeroinitializer, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13, !14, !15}
@@ -58,7 +58,7 @@ target triple = "aarch64_be--linux-gnu"
 !1 = !DIFile(filename: "bitfields.c", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "b", scope: !0, file: !5, line: 8, type: !6, isLocal: false, isDefinition: true, variable: %struct.bitfield* @b)
+!4 = !DIGlobalVariable(name: "b", scope: !0, file: !5, line: 8, type: !6, isLocal: false, isDefinition: true)
 !5 = !DIFile(filename: "bitfields.c", directory: "/")
 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "bitfield", file: !5, line: 1, size: 96, align: 32, elements: !7)
 !7 = !{!8, !10, !11, !12}
index 55886d2..2aaf169 100644 (file)
@@ -39,8 +39,8 @@ target triple = "aarch64-apple-ios"
 %struct.A = type { i8, i8*, i8 }
 %struct.B = type { i8 }
 
-@a = global i64 0, align 8
-@b = global i32* null, align 8
+@a = global i64 0, align 8, !dbg !41
+@b = global i32* null, align 8, !dbg !42
 
 define void @_Z3f131A(%struct.A* nocapture readonly %p1) #0 !dbg !25 {
 entry:
@@ -200,8 +200,8 @@ attributes #5 = { builtin }
 !38 = !DILocalVariable(name: "c", line: 19, scope: !34, file: !26, type: !4)
 !39 = !DILocalVariable(name: "d", line: 20, scope: !34, file: !26, type: !14)
 !40 = !{!41, !42}
-!41 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !26, type: !20, variable: i64* @a)
-!42 = !DIGlobalVariable(name: "b", line: 7, isLocal: false, isDefinition: true, scope: null, file: !26, type: !12, variable: i32** @b)
+!41 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !26, type: !20)
+!42 = !DIGlobalVariable(name: "b", line: 7, isLocal: false, isDefinition: true, scope: null, file: !26, type: !12)
 !43 = !{i32 2, !"Dwarf Version", i32 2}
 !44 = !{i32 2, !"Debug Info Version", i32 3}
 !45 = !{!"clang version 3.7.0 "}
index 0153e99..942306d 100644 (file)
@@ -12,7 +12,7 @@ target datalayout = "E-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
 
 %struct.S = type { i24 }
 
-@s = common global %struct.S zeroinitializer, align 4
+@s = common global %struct.S zeroinitializer, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!12, !13, !14}
@@ -22,7 +22,7 @@ target datalayout = "E-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
 !1 = !DIFile(filename: "bitfield.c", directory: "/Volumes/Data/llvm")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "s", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true, variable: %struct.S* @s)
+!4 = distinct !DIGlobalVariable(name: "s", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true)
 !5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 1, size: 32, align: 32, elements: !6)
 !6 = !{!7, !9, !10, !11}
 ; CHECK: DW_TAG_member
index 6fe1d48..c755f3b 100644 (file)
@@ -20,7 +20,7 @@ target triple = "thumbv7-apple-ios"
 
 %struct.anon = type { i8, [5 x i8] }
 
-@a = common global %struct.anon zeroinitializer, align 1
+@a = common global %struct.anon zeroinitializer, align 1, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!11, !12, !13, !14, !15}
@@ -30,7 +30,7 @@ target triple = "thumbv7-apple-ios"
 !1 = !DIFile(filename: "test.i", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, variable: %struct.anon* @a)
+!4 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true)
 !5 = !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 1, size: 48, align: 8, elements: !6)
 !6 = !{!7, !9}
 !7 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !5, file: !1, line: 2, baseType: !8, size: 8, align: 8)
index 88c3195..c166e06 100644 (file)
@@ -15,8 +15,8 @@
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 target triple = "armv7--linux-gnueabihf"
 
-@ch = common global i8 0, align 1
-@b = common global i32 0, align 4
+@ch = common global i8 0, align 1, !dbg !8
+@b = common global i32 0, align 4, !dbg !10
 
 ; Function Attrs: nounwind
 define void @proc() #0 !dbg !4 {
@@ -39,9 +39,9 @@ attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"=
 !5 = !DISubroutineType(types: !6)
 !6 = !{null}
 !7 = !{!8, !10}
-!8 = !DIGlobalVariable(name: "ch", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i8* @ch)
+!8 = !DIGlobalVariable(name: "ch", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true)
 !9 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
-!10 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 2, type: !11, isLocal: false, isDefinition: true, variable: i32* @b)
+!10 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 2, type: !11, isLocal: false, isDefinition: true)
 !11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !12 = !{i32 2, !"Dwarf Version", i32 4}
 !13 = !{i32 2, !"Debug Info Version", i32 3}
index 3ef51e8..d7d78cf 100644 (file)
@@ -6,7 +6,7 @@
 ; Generated with clang with source
 ; __thread int x;
 
-@x = thread_local global i32 0, align 4
+@x = thread_local global i32 0, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
@@ -26,7 +26,7 @@
 !1 = !DIFile(filename: "tls.c", directory: "/tmp")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "x", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: i32* @x)
+!4 = !DIGlobalVariable(name: "x", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "tls.c", directory: "/tmp")
 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !{i32 2, !"Dwarf Version", i32 4}
index f39fed6..2cce034 100644 (file)
@@ -36,7 +36,7 @@ target triple = "i686-pc-windows-msvc18.0.0"
 %struct.S = type { i32, %struct.anon }
 %struct.anon = type { i32 }
 
-@s = common global %struct.S zeroinitializer, align 4
+@s = common global %struct.S zeroinitializer, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!14, !15}
@@ -46,7 +46,7 @@ target triple = "i686-pc-windows-msvc18.0.0"
 !1 = !DIFile(filename: "-", directory: "/usr/local/google/home/majnemer/llvm/src")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "s", scope: !0, file: !5, line: 5, type: !6, isLocal: false, isDefinition: true, variable: %struct.S* @s)
+!4 = distinct !DIGlobalVariable(name: "s", scope: !0, file: !5, line: 5, type: !6, isLocal: false, isDefinition: true)
 !5 = !DIFile(filename: "<stdin>", directory: "/usr/local/google/home/majnemer/llvm/src")
 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 2, size: 64, align: 32, elements: !7)
 !7 = !{!8, !10}
index ffce72e..dbd2e98 100644 (file)
@@ -57,7 +57,7 @@ source_filename = "t.cpp"
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc19.0.23918"
 
-@"\01?x@@3W4BigThing@@A" = global i32 0, align 4
+@"\01?x@@3W4BigThing@@A" = global i32 0, align 4, !dbg !5703
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!5704, !5705, !5706}
@@ -5766,7 +5766,7 @@ target triple = "x86_64-pc-windows-msvc19.0.23918"
 !5700 = !DIEnumerator(name: "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE5695", value: 5694)
 !5701 = !DIEnumerator(name: "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE5696", value: 5695)
 !5702 = !{!5703}
-!5703 = distinct !DIGlobalVariable(name: "x", linkageName: "\01?x@@3W4BigThing@@A", scope: !0, file: !1, line: 5698, type: !3, isLocal: false, isDefinition: true, variable: i32* @"\01?x@@3W4BigThing@@A")
+!5703 = distinct !DIGlobalVariable(name: "x", linkageName: "\01?x@@3W4BigThing@@A", scope: !0, file: !1, line: 5698, type: !3, isLocal: false, isDefinition: true)
 !5704 = !{i32 2, !"CodeView", i32 1}
 !5705 = !{i32 2, !"Debug Info Version", i32 3}
 !5706 = !{i32 1, !"PIC Level", i32 2}
index 817bb88..5b01286 100644 (file)
@@ -181,9 +181,9 @@ target triple = "x86_64-pc-windows-msvc18.0.0"
 %struct.anon = type <{ i8, i16 }>
 %struct.S2 = type { i32 }
 
-@s0 = common global %struct.S0 zeroinitializer, align 1
-@s1 = common global %struct.S1 zeroinitializer, align 1
-@s2 = common global %struct.S2 zeroinitializer, align 1
+@s0 = common global %struct.S0 zeroinitializer, align 1, !dbg !4
+@s1 = common global %struct.S1 zeroinitializer, align 1, !dbg !10
+@s2 = common global %struct.S2 zeroinitializer, align 1, !dbg !29
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!33, !34, !35}
@@ -193,13 +193,13 @@ target triple = "x86_64-pc-windows-msvc18.0.0"
 !1 = !DIFile(filename: "-", directory: "/usr/local/google/home/majnemer/llvm/src")
 !2 = !{}
 !3 = !{!4, !10, !29}
-!4 = distinct !DIGlobalVariable(name: "s0", scope: !0, file: !5, line: 7, type: !6, isLocal: false, isDefinition: true, variable: %struct.S0* @s0)
+!4 = distinct !DIGlobalVariable(name: "s0", scope: !0, file: !5, line: 7, type: !6, isLocal: false, isDefinition: true)
 !5 = !DIFile(filename: "<stdin>", directory: "/usr/local/google/home/majnemer/llvm/src")
 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S0", file: !5, line: 3, size: 24, align: 8, elements: !7)
 !7 = !{!8}
 !8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !5, line: 6, baseType: !9, size: 8, align: 16, offset: 16, flags: DIFlagBitField, extraData: i64 8)
 !9 = !DIBasicType(name: "short", size: 16, align: 16, encoding: DW_ATE_signed)
-!10 = distinct !DIGlobalVariable(name: "s1", scope: !0, file: !5, line: 18, type: !11, isLocal: false, isDefinition: true, variable: %struct.S1* @s1)
+!10 = distinct !DIGlobalVariable(name: "s1", scope: !0, file: !5, line: 18, type: !11, isLocal: false, isDefinition: true)
 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S1", file: !5, line: 10, size: 128, align: 8, elements: !12)
 !12 = !{!13, !18, !19, !21, !22, !23, !28}
 !13 = !DIDerivedType(tag: DW_TAG_member, name: "x1", scope: !11, file: !5, line: 11, baseType: !14, size: 16, align: 8)
@@ -218,7 +218,7 @@ target triple = "x86_64-pc-windows-msvc18.0.0"
 !26 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !24, file: !5, line: 16, baseType: !15, size: 8, align: 8)
 !27 = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: !24, file: !5, line: 16, baseType: !9, size: 16, align: 16, offset: 8)
 !28 = !DIDerivedType(tag: DW_TAG_member, name: "u", scope: !11, file: !5, line: 17, baseType: !9, size: 3, align: 16, offset: 112, flags: DIFlagBitField, extraData: i64 112)
-!29 = distinct !DIGlobalVariable(name: "s2", scope: !0, file: !5, line: 24, type: !30, isLocal: false, isDefinition: true, variable: %struct.S2* @s2)
+!29 = distinct !DIGlobalVariable(name: "s2", scope: !0, file: !5, line: 24, type: !30, isLocal: false, isDefinition: true)
 !30 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S2", file: !5, line: 21, size: 32, align: 8, elements: !31)
 !31 = !{!32}
 !32 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !30, file: !5, line: 23, baseType: !20, size: 1, align: 32, flags: DIFlagBitField, extraData: i64 0)
index 1244c40..602435f 100644 (file)
@@ -27,7 +27,7 @@
 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i686-pc-windows-msvc18.0.0"
 
-@"\01?e@@3W4E@@A" = global i32 0, align 4
+@"\01?e@@3W4E@@A" = global i32 0, align 4, !dbg !9
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!10, !11}
@@ -42,7 +42,7 @@ target triple = "i686-pc-windows-msvc18.0.0"
 !6 = !{!7}
 !7 = !DIEnumerator(name: "BLAH", value: 0)
 !8 = !{!9}
-!9 = distinct !DIGlobalVariable(name: "e", linkageName: "\01?e@@3W4E@@A", scope: !0, file: !4, line: 2, type: !3, isLocal: false, isDefinition: true, variable: i32* @"\01?e@@3W4E@@A")
+!9 = distinct !DIGlobalVariable(name: "e", linkageName: "\01?e@@3W4E@@A", scope: !0, file: !4, line: 2, type: !3, isLocal: false, isDefinition: true)
 !10 = !{i32 2, !"CodeView", i32 1}
 !11 = !{i32 2, !"Debug Info Version", i32 3}
 !12 = !{!"clang version 3.9.0 (trunk 272790) (llvm/trunk 272813)"}
index 9d21a43..0c2308f 100644 (file)
@@ -5,7 +5,7 @@
 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i686-pc-windows-msvc"
 
-@"\01?id@?$numpunct@D@@0HA" = available_externally dllimport global i32 0, align 4
+@"\01?id@?$numpunct@D@@0HA" = available_externally dllimport global i32 0, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13, !14}
@@ -15,7 +15,7 @@ target triple = "i686-pc-windows-msvc"
 !1 = !DIFile(filename: "/usr/local/google/home/majnemer/Downloads/<stdin>", directory: "/usr/local/google/home/majnemer/llvm/src")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "id", linkageName: "\01?id@?$numpunct@D@@0HA", scope: !0, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, variable: i32* @"\01?id@?$numpunct@D@@0HA", declaration: !7)
+!4 = distinct !DIGlobalVariable(name: "id", linkageName: "\01?id@?$numpunct@D@@0HA", scope: !0, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, declaration: !7)
 !5 = !DIFile(filename: "/usr/local/google/home/majnemer/Downloads/t.ii", directory: "/usr/local/google/home/majnemer/llvm/src")
 !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !DIDerivedType(tag: DW_TAG_member, name: "id", scope: !8, file: !5, line: 2, baseType: !6, flags: DIFlagStaticMember)
index 35a1df2..f3b9943 100644 (file)
@@ -15,7 +15,7 @@ source_filename = "t.ii"
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc19.0.0"
 
-@x = global i32 42
+@x = global i32 42, !dbg !6
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!35, !36, !37}
@@ -27,7 +27,7 @@ target triple = "x86_64-pc-windows-msvc19.0.0"
 !3 = !{!4, !6}
 !4 = distinct !DIGlobalVariable(name: "_OptionsStorage", scope: !0, file: !1, line: 3, type: !5, isLocal: true, isDefinition: true)
 !5 = !DIBasicType(name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
-!6 = distinct !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 4, type: !5, isLocal: true, isDefinition: true, variable: i32* @x)
+!6 = distinct !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 4, type: !5, isLocal: true, isDefinition: true)
 
 !35 = !{i32 2, !"CodeView", i32 1}
 !36 = !{i32 2, !"Debug Info Version", i32 3}
index 8e4d6e5..2f520ba 100644 (file)
@@ -117,10 +117,10 @@ target triple = "x86_64-pc-windows-msvc19.0.23918"
 
 $"\01?comdat@?$A@X@@2HB" = comdat any
 
-@"\01?first@@3HA" = internal global i32 0, align 4
-@"\01?comdat@?$A@X@@2HB" = linkonce_odr constant i32 3, comdat, align 4
-@"\01?middle@@3PEBHEB" = thread_local global i32* @"\01?comdat@?$A@X@@2HB", align 8
-@"\01?last@@3HA" = global i32 0, align 4
+@"\01?first@@3HA" = internal global i32 0, align 4, !dbg !4
+@"\01?comdat@?$A@X@@2HB" = linkonce_odr constant i32 3, comdat, align 4, !dbg !6
+@"\01?middle@@3PEBHEB" = thread_local global i32* @"\01?comdat@?$A@X@@2HB", align 8, !dbg !13
+@"\01?last@@3HA" = global i32 0, align 4, !dbg !15
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!16, !17, !18}
@@ -130,18 +130,18 @@ $"\01?comdat@?$A@X@@2HB" = comdat any
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4, !6, !13, !15}
-!4 = distinct !DIGlobalVariable(name: "first", linkageName: "\01?first@@3HA", scope: !0, file: !1, line: 1, type: !5, isLocal: true, isDefinition: true, variable: i32* @"\01?first@@3HA")
+!4 = distinct !DIGlobalVariable(name: "first", linkageName: "\01?first@@3HA", scope: !0, file: !1, line: 1, type: !5, isLocal: true, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!6 = distinct !DIGlobalVariable(name: "comdat", linkageName: "\01?comdat@?$A@X@@2HB", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @"\01?comdat@?$A@X@@2HB", declaration: !8)
+!6 = distinct !DIGlobalVariable(name: "comdat", linkageName: "\01?comdat@?$A@X@@2HB", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, declaration: !8)
 !7 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !5)
 !8 = !DIDerivedType(tag: DW_TAG_member, name: "comdat", scope: !9, file: !1, line: 2, baseType: !7, flags: DIFlagStaticMember, extraData: i32 3)
 !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<void>", file: !1, line: 2, size: 8, align: 8, elements: !10, templateParams: !11)
 !10 = !{!8}
 !11 = !{!12}
 !12 = !DITemplateTypeParameter(name: "T", type: null)
-!13 = distinct !DIGlobalVariable(name: "middle", linkageName: "\01?middle@@3PEBHEB", scope: !0, file: !1, line: 3, type: !14, isLocal: false, isDefinition: true, variable: i32** @"\01?middle@@3PEBHEB")
+!13 = distinct !DIGlobalVariable(name: "middle", linkageName: "\01?middle@@3PEBHEB", scope: !0, file: !1, line: 3, type: !14, isLocal: false, isDefinition: true)
 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64)
-!15 = distinct !DIGlobalVariable(name: "last", linkageName: "\01?last@@3HA", scope: !0, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, variable: i32* @"\01?last@@3HA")
+!15 = distinct !DIGlobalVariable(name: "last", linkageName: "\01?last@@3HA", scope: !0, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true)
 !16 = !{i32 2, !"CodeView", i32 1}
 !17 = !{i32 2, !"Debug Info Version", i32 3}
 !18 = !{i32 1, !"PIC Level", i32 2}
index a556f1d..1c0e9de 100644 (file)
@@ -83,7 +83,7 @@ $"\01??_8B@@7B@" = comdat any
 
 $"\01??_8C@@7B@" = comdat any
 
-@"\01?d@@3UD@@A" = global %struct.D zeroinitializer, align 8
+@"\01?d@@3UD@@A" = global %struct.D zeroinitializer, align 8, !dbg !4
 @"\01??_8D@@7BB@@@" = linkonce_odr unnamed_addr constant [2 x i32] [i32 0, i32 40], comdat
 @"\01??_8D@@7BC@@@" = linkonce_odr unnamed_addr constant [2 x i32] [i32 0, i32 24], comdat
 @"\01??_7D@@6B@" = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void (%struct.D*)* @"\01?f@D@@UEAAXXZ" to i8*)], comdat
@@ -230,7 +230,7 @@ attributes #4 = { nounwind }
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "d", linkageName: "\01?d@@3UD@@A", scope: !0, file: !1, line: 9, type: !5, isLocal: false, isDefinition: true, variable: %struct.D* @"\01?d@@3UD@@A")
+!4 = distinct !DIGlobalVariable(name: "d", linkageName: "\01?d@@3UD@@A", scope: !0, file: !1, line: 9, type: !5, isLocal: false, isDefinition: true)
 !5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D", file: !1, line: 4, size: 448, align: 64, elements: !6, vtableHolder: !5, identifier: ".?AUD@@")
 !6 = !{!7, !21, !27, !28, !29}
 !7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !5, baseType: !8, offset: 64)
index e5240cc..93c54f4 100644 (file)
@@ -44,7 +44,7 @@
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc18.0.0"
 
-@x = common global i32 0, align 4
+@x = common global i32 0, align 4, !dbg !9
 
 ; Function Attrs: norecurse nounwind uwtable
 define void @f() #0 !dbg !4 {
@@ -84,7 +84,7 @@ attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-
 !6 = !{null}
 !7 = distinct !DISubprogram(name: "file_change", scope: !1, file: !1, line: 2, type: !5, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
 !8 = !{!9}
-!9 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true, variable: i32* @x)
+!9 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true)
 !10 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !11)
 !11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !12 = !{i32 2, !"CodeView", i32 1}
index 143bd48..a74e499 100644 (file)
@@ -106,7 +106,7 @@ source_filename = "t.cpp"
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc19.0.24210"
 
-@"\01?x@@3HC" = global i32 0, align 4
+@"\01?x@@3HC" = global i32 0, align 4, !dbg !4
 
 ; Function Attrs: norecurse nounwind uwtable
 define i32 @main() local_unnamed_addr #0 !dbg !11 {
@@ -140,7 +140,7 @@ attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "x", linkageName: "\01?x@@3HC", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @"\01?x@@3HC")
+!4 = distinct !DIGlobalVariable(name: "x", linkageName: "\01?x@@3HC", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !6)
 !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !{i32 2, !"CodeView", i32 1}
index 55ce3de..ba533c3 100644 (file)
@@ -41,7 +41,7 @@
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc18.0.0"
 
-@"\01?x@@3HC" = global i32 0, align 4
+@"\01?x@@3HC" = global i32 0, align 4, !dbg !14
 
 ; Function Attrs: norecurse nounwind uwtable
 define i32 @main() #0 !dbg !4 {
@@ -71,7 +71,7 @@ attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-
 !11 = distinct !DISubprogram(name: "g", linkageName: "\01?g@@YAXXZ", scope: !1, file: !1, line: 6, type: !9, isLocal: true, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
 !12 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAXXZ", scope: !1, file: !1, line: 2, type: !9, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
 !13 = !{!14}
-!14 = !DIGlobalVariable(name: "x", linkageName: "\01?x@@3HC", scope: !0, file: !1, line: 1, type: !15, isLocal: false, isDefinition: true, variable: i32* @"\01?x@@3HC")
+!14 = !DIGlobalVariable(name: "x", linkageName: "\01?x@@3HC", scope: !0, file: !1, line: 1, type: !15, isLocal: false, isDefinition: true)
 !15 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
 !16 = !{i32 2, !"CodeView", i32 1}
 !17 = !{i32 2, !"Debug Info Version", i32 3}
index 5392ea6..09afa64 100644 (file)
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc18.0.0"
 
-@x = internal global i32 0, align 4
+@x = internal global i32 0, align 4, !dbg !23
 
 ; Function Attrs: nounwind uwtable
 define void @f(i32 %p) #0 !dbg !4 {
@@ -261,7 +261,7 @@ attributes #3 = { nounwind }
 !20 = !DILocalVariable(name: "a", arg: 1, scope: !16, file: !1, line: 4, type: !7)
 !21 = !DILocalVariable(name: "b", scope: !16, file: !1, line: 5, type: !7)
 !22 = !{!23}
-!23 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !24, isLocal: false, isDefinition: true, variable: i32* @x)
+!23 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !24, isLocal: false, isDefinition: true)
 !24 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
 !25 = !{i32 2, !"CodeView", i32 1}
 !26 = !{i32 2, !"Debug Info Version", i32 3}
index d7b4962..2d144ca 100644 (file)
@@ -79,7 +79,7 @@ target triple = "x86_64-pc-windows-msvc19.0.23918"
 %"struct.foo::bar::GlobalRecord" = type { i32 }
 %struct.LocalRecord = type { i32 }
 
-@"\01?g@bar@foo@@3UGlobalRecord@12@A" = global %"struct.foo::bar::GlobalRecord" zeroinitializer, align 4
+@"\01?g@bar@foo@@3UGlobalRecord@12@A" = global %"struct.foo::bar::GlobalRecord" zeroinitializer, align 4, !dbg !4
 
 ; Function Attrs: nounwind uwtable
 define void @"\01?baz@bar@foo@@YAXXZ"() #0 !dbg !19 {
@@ -113,7 +113,7 @@ attributes #1 = { nounwind readnone }
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "g", linkageName: "\01?g@bar@foo@@3UGlobalRecord@12@A", scope: !5, file: !1, line: 12, type: !7, isLocal: false, isDefinition: true, variable: %"struct.foo::bar::GlobalRecord"* @"\01?g@bar@foo@@3UGlobalRecord@12@A")
+!4 = distinct !DIGlobalVariable(name: "g", linkageName: "\01?g@bar@foo@@3UGlobalRecord@12@A", scope: !5, file: !1, line: 12, type: !7, isLocal: false, isDefinition: true)
 !5 = !DINamespace(name: "bar", scope: !6, file: !1, line: 2)
 !6 = !DINamespace(name: "foo", scope: null, file: !1, line: 1)
 !7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "GlobalRecord", scope: !5, file: !1, line: 9, size: 32, align: 32, elements: !8, identifier: ".?AUGlobalRecord@bar@foo@@")
index fbca98f..db8b0d7 100644 (file)
@@ -127,10 +127,10 @@ target triple = "i686-pc-windows-msvc18.0.31101"
 
 %struct.incomplete_struct = type { i32 }
 
-@"\01?multi_dim_arr@@3PAY146DA" = global [2 x [5 x [7 x i8]]] zeroinitializer, align 1
-@"\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A" = global [3 x i8]* null, align 4
-@"\01?incomplete_struct_arr@@3PAUincomplete_struct@@A" = global [3 x %struct.incomplete_struct] zeroinitializer, align 4
-@"\01?typedef_arr@@3SDHD" = constant [4 x i32] zeroinitializer, align 4
+@"\01?multi_dim_arr@@3PAY146DA" = global [2 x [5 x [7 x i8]]] zeroinitializer, align 1, !dbg !4
+@"\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A" = global [3 x i8]* null, align 4, !dbg !11
+@"\01?incomplete_struct_arr@@3PAUincomplete_struct@@A" = global [3 x %struct.incomplete_struct] zeroinitializer, align 4, !dbg !20
+@"\01?typedef_arr@@3SDHD" = constant [4 x i32] zeroinitializer, align 4, !dbg !21
 
 ; Function Attrs: nounwind
 define void @"\01?foo@@YAXH@Z"(i32 %x) #0 !dbg !31 {
@@ -172,14 +172,14 @@ attributes #2 = { nounwind }
 !1 = !DIFile(filename: "t.cpp", directory: "/")
 !2 = !{}
 !3 = !{!4, !11, !20, !21}
-!4 = distinct !DIGlobalVariable(name: "multi_dim_arr", linkageName: "\01?multi_dim_arr@@3PAY146DA", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: [2 x [5 x [7 x i8]]]* @"\01?multi_dim_arr@@3PAY146DA")
+!4 = distinct !DIGlobalVariable(name: "multi_dim_arr", linkageName: "\01?multi_dim_arr@@3PAY146DA", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 560, align: 8, elements: !7)
 !6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
 !7 = !{!8, !9, !10}
 !8 = !DISubrange(count: 2)
 !9 = !DISubrange(count: 5)
 !10 = !DISubrange(count: 7)
-!11 = distinct !DIGlobalVariable(name: "p_incomplete_struct_arr", linkageName: "\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A", scope: !0, file: !1, line: 3, type: !12, isLocal: false, isDefinition: true, variable: [3 x i8]** @"\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A")
+!11 = distinct !DIGlobalVariable(name: "p_incomplete_struct_arr", linkageName: "\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A", scope: !0, file: !1, line: 3, type: !12, isLocal: false, isDefinition: true)
 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 32, align: 32)
 !13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, elements: !18)
 !14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "incomplete_struct", file: !1, line: 4, size: 32, align: 32, elements: !15, identifier: ".?AUincomplete_struct@@")
@@ -188,8 +188,8 @@ attributes #2 = { nounwind }
 !17 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !18 = !{!19}
 !19 = !DISubrange(count: 3)
-!20 = distinct !DIGlobalVariable(name: "incomplete_struct_arr", linkageName: "\01?incomplete_struct_arr@@3PAUincomplete_struct@@A", scope: !0, file: !1, line: 6, type: !13, isLocal: false, isDefinition: true, variable: [3 x %struct.incomplete_struct]* @"\01?incomplete_struct_arr@@3PAUincomplete_struct@@A")
-!21 = distinct !DIGlobalVariable(name: "typedef_arr", linkageName: "\01?typedef_arr@@3SDHD", scope: !0, file: !1, line: 14, type: !22, isLocal: false, isDefinition: true, variable: [4 x i32]* @"\01?typedef_arr@@3SDHD")
+!20 = distinct !DIGlobalVariable(name: "incomplete_struct_arr", linkageName: "\01?incomplete_struct_arr@@3PAUincomplete_struct@@A", scope: !0, file: !1, line: 6, type: !13, isLocal: false, isDefinition: true)
+!21 = distinct !DIGlobalVariable(name: "typedef_arr", linkageName: "\01?typedef_arr@@3SDHD", scope: !0, file: !1, line: 14, type: !22, isLocal: false, isDefinition: true)
 !22 = !DICompositeType(tag: DW_TAG_array_type, baseType: !23, size: 128, align: 32, elements: !26)
 !23 = !DIDerivedType(tag: DW_TAG_typedef, name: "T_INT", file: !1, line: 13, baseType: !24)
 !24 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !25)
index ecb1fdf..0de7bb0 100644 (file)
@@ -79,7 +79,7 @@ target triple = "i686-pc-windows-msvc19.0.23918"
 
 %struct.A = type { i8 }
 
-@"\01?a@@3UA@@A" = global %struct.A zeroinitializer, align 1
+@"\01?a@@3UA@@A" = global %struct.A zeroinitializer, align 1, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!8, !9}
@@ -89,7 +89,7 @@ target triple = "i686-pc-windows-msvc19.0.23918"
 !1 = !DIFile(filename: "hello.cpp", directory: "D:\5Csrc\5Chello")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "a", linkageName: "\01?a@@3UA@@A", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, variable: %struct.A* @"\01?a@@3UA@@A")
+!4 = distinct !DIGlobalVariable(name: "a", linkageName: "\01?a@@3UA@@A", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true)
 !5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 1, size: 8, align: 8, elements: !6, identifier: ".?AUA@@")
 !6 = !{!7}
 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !5, file: !1, line: 2, size: 8, align: 8, flags: DIFlagFwdDecl, identifier: ".?AUNested@A@@")
index 76b12a0..04a9d87 100644 (file)
@@ -184,16 +184,16 @@ target triple = "x86_64-pc-windows-msvc19.0.23918"
 %0 = type opaque
 %1 = type opaque
 
-@"\01?pmd_a@@3PEQA@@HEQ1@" = global i32 -1, align 8
-@"\01?pmd_b@@3PEQC@@HEQ1@" = global i32 -1, align 8
-@"\01?pmd_c@@3PEQD@@HEQ1@" = global { i32, i32 } { i32 0, i32 -1 }, align 8
-@"\01?pmd_d@@3PEQE@@HEQ1@" = global { i32, i32, i32 } { i32 0, i32 0, i32 -1 }, align 8
-@"\01?pmf_a@@3P8A@@EAAXXZEQ1@" = global i8* null, align 8
-@"\01?pmf_b@@3P8C@@EAAXXZEQ1@" = global { i8*, i32 } zeroinitializer, align 8
-@"\01?pmf_c@@3P8D@@EAAXXZEQ1@" = global { i8*, i32, i32 } zeroinitializer, align 8
-@"\01?pmf_d@@3P8E@@EAAXXZEQ1@" = global { i8*, i32, i32, i32 } zeroinitializer, align 8
-@"\01?ppmd@@3PEAPEQIncomplete@@HEA" = global %0* null, align 8
-@"\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA" = global %1* null, align 8
+@"\01?pmd_a@@3PEQA@@HEQ1@" = global i32 -1, align 8, !dbg !4
+@"\01?pmd_b@@3PEQC@@HEQ1@" = global i32 -1, align 8, !dbg !10
+@"\01?pmd_c@@3PEQD@@HEQ1@" = global { i32, i32 } { i32 0, i32 -1 }, align 8, !dbg !20
+@"\01?pmd_d@@3PEQE@@HEQ1@" = global { i32, i32, i32 } { i32 0, i32 0, i32 -1 }, align 8, !dbg !23
+@"\01?pmf_a@@3P8A@@EAAXXZEQ1@" = global i8* null, align 8, !dbg !26
+@"\01?pmf_b@@3P8C@@EAAXXZEQ1@" = global { i8*, i32 } zeroinitializer, align 8, !dbg !31
+@"\01?pmf_c@@3P8D@@EAAXXZEQ1@" = global { i8*, i32, i32 } zeroinitializer, align 8, !dbg !36
+@"\01?pmf_d@@3P8E@@EAAXXZEQ1@" = global { i8*, i32, i32, i32 } zeroinitializer, align 8, !dbg !41
+@"\01?ppmd@@3PEAPEQIncomplete@@HEA" = global %0* null, align 8, !dbg !46
+@"\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA" = global %1* null, align 8, !dbg !50
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!56, !57, !58}
@@ -203,13 +203,13 @@ target triple = "x86_64-pc-windows-msvc19.0.23918"
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4, !10, !20, !23, !26, !31, !36, !41, !46, !50}
-!4 = distinct !DIGlobalVariable(name: "pmd_a", linkageName: "\01?pmd_a@@3PEQA@@HEQ1@", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true, variable: i32* @"\01?pmd_a@@3PEQA@@HEQ1@")
+!4 = distinct !DIGlobalVariable(name: "pmd_a", linkageName: "\01?pmd_a@@3PEQA@@HEQ1@", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 32, flags: DIFlagSingleInheritance, extraData: !7)
 !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 1, size: 32, align: 32, elements: !8, identifier: ".?AUA@@")
 !8 = !{!9}
 !9 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !7, file: !1, line: 1, baseType: !6, size: 32, align: 32)
-!10 = distinct !DIGlobalVariable(name: "pmd_b", linkageName: "\01?pmd_b@@3PEQC@@HEQ1@", scope: !0, file: !1, line: 7, type: !11, isLocal: false, isDefinition: true, variable: i32* @"\01?pmd_b@@3PEQC@@HEQ1@")
+!10 = distinct !DIGlobalVariable(name: "pmd_b", linkageName: "\01?pmd_b@@3PEQC@@HEQ1@", scope: !0, file: !1, line: 7, type: !11, isLocal: false, isDefinition: true)
 !11 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 32, flags: DIFlagMultipleInheritance, extraData: !12)
 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !1, line: 3, size: 96, align: 32, elements: !13, identifier: ".?AUC@@")
 !13 = !{!14, !15, !19}
@@ -219,37 +219,37 @@ target triple = "x86_64-pc-windows-msvc19.0.23918"
 !17 = !{!18}
 !18 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !16, file: !1, line: 2, baseType: !6, size: 32, align: 32)
 !19 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !12, file: !1, line: 3, baseType: !6, size: 32, align: 32, offset: 64)
-!20 = distinct !DIGlobalVariable(name: "pmd_c", linkageName: "\01?pmd_c@@3PEQD@@HEQ1@", scope: !0, file: !1, line: 8, type: !21, isLocal: false, isDefinition: true, variable: { i32, i32 }* @"\01?pmd_c@@3PEQD@@HEQ1@")
+!20 = distinct !DIGlobalVariable(name: "pmd_c", linkageName: "\01?pmd_c@@3PEQD@@HEQ1@", scope: !0, file: !1, line: 8, type: !21, isLocal: false, isDefinition: true)
 !21 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 64, flags: DIFlagVirtualInheritance, extraData: !22)
 !22 = !DICompositeType(tag: DW_TAG_structure_type, name: "D", file: !1, line: 4, size: 256, align: 64, flags: DIFlagFwdDecl, identifier: ".?AUD@@")
-!23 = distinct !DIGlobalVariable(name: "pmd_d", linkageName: "\01?pmd_d@@3PEQE@@HEQ1@", scope: !0, file: !1, line: 9, type: !24, isLocal: false, isDefinition: true, variable: { i32, i32, i32 }* @"\01?pmd_d@@3PEQE@@HEQ1@")
+!23 = distinct !DIGlobalVariable(name: "pmd_d", linkageName: "\01?pmd_d@@3PEQE@@HEQ1@", scope: !0, file: !1, line: 9, type: !24, isLocal: false, isDefinition: true)
 !24 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 96, extraData: !25)
 !25 = !DICompositeType(tag: DW_TAG_structure_type, name: "E", file: !1, line: 5, flags: DIFlagFwdDecl, identifier: ".?AUE@@")
-!26 = distinct !DIGlobalVariable(name: "pmf_a", linkageName: "\01?pmf_a@@3P8A@@EAAXXZEQ1@", scope: !0, file: !1, line: 10, type: !27, isLocal: false, isDefinition: true, variable: i8** @"\01?pmf_a@@3P8A@@EAAXXZEQ1@")
+!26 = distinct !DIGlobalVariable(name: "pmf_a", linkageName: "\01?pmf_a@@3P8A@@EAAXXZEQ1@", scope: !0, file: !1, line: 10, type: !27, isLocal: false, isDefinition: true)
 !27 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !28, size: 64, flags: DIFlagSingleInheritance, extraData: !7)
 !28 = !DISubroutineType(types: !29)
 !29 = !{null, !30}
 !30 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!31 = distinct !DIGlobalVariable(name: "pmf_b", linkageName: "\01?pmf_b@@3P8C@@EAAXXZEQ1@", scope: !0, file: !1, line: 11, type: !32, isLocal: false, isDefinition: true, variable: { i8*, i32 }* @"\01?pmf_b@@3P8C@@EAAXXZEQ1@")
+!31 = distinct !DIGlobalVariable(name: "pmf_b", linkageName: "\01?pmf_b@@3P8C@@EAAXXZEQ1@", scope: !0, file: !1, line: 11, type: !32, isLocal: false, isDefinition: true)
 !32 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !33, size: 128, flags: DIFlagMultipleInheritance, extraData: !12)
 !33 = !DISubroutineType(types: !34)
 !34 = !{null, !35}
 !35 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!36 = distinct !DIGlobalVariable(name: "pmf_c", linkageName: "\01?pmf_c@@3P8D@@EAAXXZEQ1@", scope: !0, file: !1, line: 12, type: !37, isLocal: false, isDefinition: true, variable: { i8*, i32, i32 }* @"\01?pmf_c@@3P8D@@EAAXXZEQ1@")
+!36 = distinct !DIGlobalVariable(name: "pmf_c", linkageName: "\01?pmf_c@@3P8D@@EAAXXZEQ1@", scope: !0, file: !1, line: 12, type: !37, isLocal: false, isDefinition: true)
 !37 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !38, size: 128, flags: DIFlagVirtualInheritance, extraData: !22)
 !38 = !DISubroutineType(types: !39)
 !39 = !{null, !40}
 !40 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!41 = distinct !DIGlobalVariable(name: "pmf_d", linkageName: "\01?pmf_d@@3P8E@@EAAXXZEQ1@", scope: !0, file: !1, line: 13, type: !42, isLocal: false, isDefinition: true, variable: { i8*, i32, i32, i32 }* @"\01?pmf_d@@3P8E@@EAAXXZEQ1@")
+!41 = distinct !DIGlobalVariable(name: "pmf_d", linkageName: "\01?pmf_d@@3P8E@@EAAXXZEQ1@", scope: !0, file: !1, line: 13, type: !42, isLocal: false, isDefinition: true)
 !42 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !43, size: 192, extraData: !25)
 !43 = !DISubroutineType(types: !44)
 !44 = !{null, !45}
 !45 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!46 = distinct !DIGlobalVariable(name: "ppmd", linkageName: "\01?ppmd@@3PEAPEQIncomplete@@HEA", scope: !0, file: !1, line: 15, type: !47, isLocal: false, isDefinition: true, variable: %0** @"\01?ppmd@@3PEAPEQIncomplete@@HEA")
+!46 = distinct !DIGlobalVariable(name: "ppmd", linkageName: "\01?ppmd@@3PEAPEQIncomplete@@HEA", scope: !0, file: !1, line: 15, type: !47, isLocal: false, isDefinition: true)
 !47 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !48, size: 64, align: 64)
 !48 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, extraData: !49)
 !49 = !DICompositeType(tag: DW_TAG_structure_type, name: "Incomplete", file: !1, line: 14, flags: DIFlagFwdDecl, identifier: ".?AUIncomplete@@")
-!50 = distinct !DIGlobalVariable(name: "ppmf", linkageName: "\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA", scope: !0, file: !1, line: 16, type: !51, isLocal: false, isDefinition: true, variable: %1** @"\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA")
+!50 = distinct !DIGlobalVariable(name: "ppmf", linkageName: "\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA", scope: !0, file: !1, line: 16, type: !51, isLocal: false, isDefinition: true)
 !51 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !52, size: 64, align: 64)
 !52 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !53, extraData: !49)
 !53 = !DISubroutineType(types: !54)
index bb0686f..d907cfd 100644 (file)
@@ -55,7 +55,7 @@ target triple = "i686-pc-windows-msvc18.0.0"
 %struct.S = type { i32 }
 %union.pun = type { i32 }
 
-@"\01?u@@3UU@@A" = global %struct.U zeroinitializer, align 4
+@"\01?u@@3UU@@A" = global %struct.U zeroinitializer, align 4, !dbg !4
 
 ; Function Attrs: nounwind uwtable
 define void @"\01?f@@YAXXZ"() #0 !dbg !14 {
@@ -97,7 +97,7 @@ attributes #1 = { nounwind readnone }
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "u", linkageName: "\01?u@@3UU@@A", scope: !0, file: !1, line: 13, type: !5, isLocal: false, isDefinition: true, variable: %struct.U* @"\01?u@@3UU@@A")
+!4 = distinct !DIGlobalVariable(name: "u", linkageName: "\01?u@@3UU@@A", scope: !0, file: !1, line: 13, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIDerivedType(tag: DW_TAG_typedef, name: "U", file: !1, line: 12, baseType: !6)
 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 12, size: 32, align: 32, elements: !7, identifier: ".?AUU@@")
 !7 = !{!8}
index ebc54b5..12958bb 100644 (file)
@@ -121,7 +121,7 @@ $"\01??_7A@@6B@" = comdat largest
 
 $"\01??_R4A@@6B@" = comdat any
 
-@"\01?p@@3PEAUC@@EA" = global %struct.C* null, align 8
+@"\01?p@@3PEAUC@@EA" = global %struct.C* null, align 8, !dbg !4
 @0 = private unnamed_addr constant [3 x i8*] [i8* bitcast (%rtti.CompleteObjectLocator* @"\01??_R4C@@6B@" to i8*), i8* bitcast (void (%struct.C*)* @"\01?f@C@@UEAAXXZ" to i8*), i8* bitcast (void (%struct.C*)* @"\01?g@C@@UEAAXXZ" to i8*)], comdat($"\01??_7C@@6B@")
 @"\01??_R4C@@6B@" = linkonce_odr constant %rtti.CompleteObjectLocator { i32 1, i32 0, i32 0, i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%rtti.TypeDescriptor7* @"\01??_R0?AUC@@@8" to i64), i64 ptrtoint (i8* @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%rtti.ClassHierarchyDescriptor* @"\01??_R3C@@8" to i64), i64 ptrtoint (i8* @__ImageBase to i64)) to i32), i32 trunc (i64 sub nuw nsw (i64 ptrtoint (%rtti.CompleteObjectLocator* @"\01??_R4C@@6B@" to i64), i64 ptrtoint (i8* @__ImageBase to i64)) to i32) }, comdat
 @"\01??_7type_info@@6B@" = external constant i8*
@@ -237,7 +237,7 @@ attributes #6 = { nounwind }
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "p", linkageName: "\01?p@@3PEAUC@@EA", scope: !0, file: !1, line: 13, type: !5, isLocal: false, isDefinition: true, variable: %struct.C** @"\01?p@@3PEAUC@@EA")
+!4 = distinct !DIGlobalVariable(name: "p", linkageName: "\01?p@@3PEAUC@@EA", scope: !0, file: !1, line: 13, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64)
 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !1, line: 9, size: 64, align: 64, elements: !7, vtableHolder: !12, identifier: ".?AUC@@")
 !7 = !{!8, !30, !34}
index 7503e72..08a1f75 100644 (file)
@@ -40,8 +40,8 @@ target triple = "x86_64-pc-windows-msvc"
 
 $"\01??_DUseCompleteType@@QEAA@XZ" = comdat any
 
-@"\01?force_fwd_decl@@3UGetFwdDecl@@A" = global %struct.GetFwdDecl zeroinitializer, align 1
-@"\01?require_complete@@3UUseCompleteType@@A" = global %struct.UseCompleteType zeroinitializer, align 8
+@"\01?force_fwd_decl@@3UGetFwdDecl@@A" = global %struct.GetFwdDecl zeroinitializer, align 1, !dbg !4
+@"\01?require_complete@@3UUseCompleteType@@A" = global %struct.UseCompleteType zeroinitializer, align 8, !dbg !10
 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_t.cpp, i8* null }]
 
 ; Function Attrs: nounwind
@@ -100,13 +100,13 @@ attributes #3 = { nounwind readnone }
 !1 = !DIFile(filename: "<stdin>", directory: "C:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4, !10}
-!4 = distinct !DIGlobalVariable(name: "force_fwd_decl", linkageName: "\01?force_fwd_decl@@3UGetFwdDecl@@A", scope: !0, file: !5, line: 5, type: !6, isLocal: false, isDefinition: true, variable: %struct.GetFwdDecl* @"\01?force_fwd_decl@@3UGetFwdDecl@@A")
+!4 = distinct !DIGlobalVariable(name: "force_fwd_decl", linkageName: "\01?force_fwd_decl@@3UGetFwdDecl@@A", scope: !0, file: !5, line: 5, type: !6, isLocal: false, isDefinition: true)
 !5 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm\5Cbuild")
 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "GetFwdDecl", file: !5, line: 2, size: 8, align: 8, elements: !7, identifier: ".?AUGetFwdDecl@@")
 !7 = !{!8}
 !8 = !DIDerivedType(tag: DW_TAG_member, name: "format", scope: !6, file: !5, line: 3, baseType: !9, flags: DIFlagStaticMember)
 !9 = !DICompositeType(tag: DW_TAG_structure_type, name: "UnicodeString", file: !5, line: 1, flags: DIFlagFwdDecl, identifier: ".?AUUnicodeString@@")
-!10 = distinct !DIGlobalVariable(name: "require_complete", linkageName: "\01?require_complete@@3UUseCompleteType@@A", scope: !0, file: !5, line: 15, type: !11, isLocal: false, isDefinition: true, variable: %struct.UseCompleteType* @"\01?require_complete@@3UUseCompleteType@@A")
+!10 = distinct !DIGlobalVariable(name: "require_complete", linkageName: "\01?require_complete@@3UUseCompleteType@@A", scope: !0, file: !5, line: 15, type: !11, isLocal: false, isDefinition: true)
 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UseCompleteType", file: !5, line: 10, size: 64, align: 64, elements: !12, identifier: ".?AUUseCompleteType@@")
 !12 = !{!13, !17, !21}
 !13 = !DIDerivedType(tag: DW_TAG_member, name: "currencySpcAfterSym", scope: !11, file: !5, line: 13, baseType: !14, size: 64, align: 64)
index a6b7e5f..f27d323 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: llc %s -o /dev/null
-@0 = internal constant i32 1
+@0 = internal constant i32 1, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!9}
@@ -7,7 +7,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 139632)", isOptimized: true, emissionKind: FullDebug, file: !8, enums: !2, retainedTypes: !2, globals: !3)
 !2 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i32* @0)
+!5 = !DIGlobalVariable(name: "a", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "g.c", directory: "/private/tmp")
 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !8 = !DIFile(filename: "g.c", directory: "/private/tmp")
index c0b9625..e3cd486 100644 (file)
@@ -6,7 +6,7 @@
 ; CHECK-NEXT:  DW_AT_name
 
 
-@i = common global i32 0                          ; <i32*> [#uses=2]
+@i = common global i32 0, !dbg !16                          ; <i32*> [#uses=2]
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 
@@ -45,7 +45,7 @@ entry:
 !13 = !{!14, !15}
 !14 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 10, size: 32, align: 32, file: !27, scope: !12, baseType: !5)
 !15 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 10, size: 32, align: 32, offset: 32, file: !27, scope: !12, baseType: !5)
-!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5, variable: i32* @i)
+!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5)
 !17 = !DILocation(line: 15, scope: !18)
 !18 = distinct !DILexicalBlock(line: 14, column: 0, file: !1, scope: !6)
 !19 = !DILocation(line: 9, scope: !0, inlinedAt: !17)
index 477d5c8..971a768 100644 (file)
 
 
 
-@ForceTopDown = common global i32 0, align 4
-@_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_ = common global i32 0, align 4
-@_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE = common global i32 0, align 4
-@_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv = common global i32 0, align 4
-@_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE = common global i32 0, align 4
-@_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE = common global i32 0, align 4
-@k1 = common global i32 0, align 4
-@is = common global i32 0, align 4
-@setStmt = common global i32 0, align 4
-@_ZN4llvm5TwineC1Ei = common global i32 0, align 4
-@_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE = common global i32 0, align 4
-@_ZN4llvm22MachineModuleInfoMachOD2Ev = common global i32 0, align 4
+@ForceTopDown = common global i32 0, align 4, !dbg !4
+@_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_ = common global i32 0, align 4, !dbg !6
+@_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE = common global i32 0, align 4, !dbg !7
+@_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv = common global i32 0, align 4, !dbg !8
+@_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE = common global i32 0, align 4, !dbg !9
+@_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE = common global i32 0, align 4, !dbg !10
+@k1 = common global i32 0, align 4, !dbg !11
+@is = common global i32 0, align 4, !dbg !12
+@setStmt = common global i32 0, align 4, !dbg !13
+@_ZN4llvm5TwineC1Ei = common global i32 0, align 4, !dbg !14
+@_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE = common global i32 0, align 4, !dbg !15
+@_ZN4llvm22MachineModuleInfoMachOD2Ev = common global i32 0, align 4, !dbg !16
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!17, !18, !19}
 !1 = !DIFile(filename: "hash-collisions.c", directory: "/tmp")
 !2 = !{}
 !3 = !{!4, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16}
-!4 = !DIGlobalVariable(name: "ForceTopDown", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @ForceTopDown)
+!4 = !DIGlobalVariable(name: "ForceTopDown", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!6 = !DIGlobalVariable(name: "_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_)
-!7 = !DIGlobalVariable(name: "_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE)
-!8 = !DIGlobalVariable(name: "_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv", scope: !0, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv)
-!9 = !DIGlobalVariable(name: "_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE", scope: !0, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE)
-!10 = !DIGlobalVariable(name: "_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE)
-!11 = !DIGlobalVariable(name: "k1", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, variable: i32* @k1)
-!12 = !DIGlobalVariable(name: "is", scope: !0, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, variable: i32* @is)
-!13 = !DIGlobalVariable(name: "setStmt", scope: !0, file: !1, line: 9, type: !5, isLocal: false, isDefinition: true, variable: i32* @setStmt)
-!14 = !DIGlobalVariable(name: "_ZN4llvm5TwineC1Ei", scope: !0, file: !1, line: 10, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm5TwineC1Ei)
-!15 = !DIGlobalVariable(name: "_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE", scope: !0, file: !1, line: 11, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE)
-!16 = !DIGlobalVariable(name: "_ZN4llvm22MachineModuleInfoMachOD2Ev", scope: !0, file: !1, line: 12, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm22MachineModuleInfoMachOD2Ev)
+!6 = !DIGlobalVariable(name: "_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true)
+!7 = !DIGlobalVariable(name: "_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true)
+!8 = !DIGlobalVariable(name: "_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv", scope: !0, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true)
+!9 = !DIGlobalVariable(name: "_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE", scope: !0, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true)
+!10 = !DIGlobalVariable(name: "_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true)
+!11 = !DIGlobalVariable(name: "k1", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true)
+!12 = !DIGlobalVariable(name: "is", scope: !0, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true)
+!13 = !DIGlobalVariable(name: "setStmt", scope: !0, file: !1, line: 9, type: !5, isLocal: false, isDefinition: true)
+!14 = !DIGlobalVariable(name: "_ZN4llvm5TwineC1Ei", scope: !0, file: !1, line: 10, type: !5, isLocal: false, isDefinition: true)
+!15 = !DIGlobalVariable(name: "_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE", scope: !0, file: !1, line: 11, type: !5, isLocal: false, isDefinition: true)
+!16 = !DIGlobalVariable(name: "_ZN4llvm22MachineModuleInfoMachOD2Ev", scope: !0, file: !1, line: 12, type: !5, isLocal: false, isDefinition: true)
 !17 = !{i32 2, !"Dwarf Version", i32 2}
 !18 = !{i32 2, !"Debug Info Version", i32 3}
 !19 = !{i32 1, !"PIC Level", i32 2}
index 664a5d2..29924b6 100644 (file)
@@ -37,8 +37,8 @@
 ; CHECK:     DW_AT_name {{.*}}"a.cpp"
 ; CHECK:     DW_AT_name {{.*}} "func"
 
-@x = global i32 (i32)* @_Z4funci, align 8
-@y = global i32 (i32)* @_Z4funci, align 8
+@x = global i32 (i32)* @_Z4funci, align 8, !dbg !10
+@y = global i32 (i32)* @_Z4funci, align 8, !dbg !18
 
 ; Function Attrs: inlinehint nounwind uwtable
 define linkonce_odr i32 @_Z4funci(i32 %i) #0 !dbg !4 {
@@ -69,14 +69,14 @@ attributes #1 = { nounwind readnone }
 !7 = !{!8, !8}
 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !9 = !{!10}
-!10 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !5, type: !11, variable: i32 (i32)** @x)
+!10 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !5, type: !11)
 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !6)
 !12 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !13, enums: !2, retainedTypes: !2, globals: !17, imports: !2)
 !13 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo")
 !15 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !12, scopeLine: 1, file: !13, scope: !16, type: !6, variables: !2)
 !16 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo")
 !17 = !{!18}
-!18 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !11, variable: i32 (i32)** @y)
+!18 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !11)
 !19 = !{i32 2, !"Dwarf Version", i32 4}
 !20 = !{i32 1, !"Debug Info Version", i32 3}
 !21 = !{!"clang version 3.5.0 "}
index 67dfb35..7ca2540 100644 (file)
@@ -25,8 +25,8 @@
 ; CHECK: DW_TAG_compile_unit
 ; CHECK-NOT: DW_TAG_subprogram
 
-@x = global i32 (i32)* @_Z4funci, align 8
-@y = global i32 (i32)* @_Z4funci, align 8
+@x = global i32 (i32)* @_Z4funci, align 8, !dbg !11
+@y = global i32 (i32)* @_Z4funci, align 8, !dbg !16
 
 ; Function Attrs: inlinehint nounwind uwtable
 define linkonce_odr i32 @_Z4funci(i32 %i) #0 !dbg !4 {
@@ -58,12 +58,12 @@ attributes #1 = { nounwind readnone }
 !8 = !{!9, !9}
 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !10 = !{!11}
-!11 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12, variable: i32 (i32)** @x)
+!11 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12)
 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !7)
 !13 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !14, enums: !2, retainedTypes: !2, globals: !15, imports: !2)
 !14 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo")
 !15 = !{!16}
-!16 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12, variable: i32 (i32)** @y)
+!16 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12)
 !17 = !{i32 2, !"Dwarf Version", i32 4}
 !18 = !{i32 1, !"Debug Info Version", i32 3}
 !19 = !{!"clang version 3.5.0 "}
index a1bbad8..24b976b 100644 (file)
@@ -3,7 +3,7 @@
 ; Do not unnecessarily use AT_specification DIE.
 ; CHECK-NOT: AT_specification
 
-@a = common global [10 x i32] zeroinitializer, align 16
+@a = common global [10 x i32] zeroinitializer, align 16, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!12}
@@ -11,7 +11,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 140253)", isOptimized: true, emissionKind: FullDebug, file: !11, enums: !2, retainedTypes: !2, globals: !3)
 !2 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: [10 x i32]* @a)
+!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "x.c", directory: "/private/tmp")
 !7 = !DICompositeType(tag: DW_TAG_array_type, size: 320, align: 32, baseType: !8, elements: !9)
 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
index dcbdd2e..2fdbef2 100644 (file)
@@ -21,7 +21,7 @@
 %struct.Y = type { %struct.X* }
 %struct.X = type opaque
 
-@y = common global %struct.Y zeroinitializer, align 8
+@y = common global %struct.Y zeroinitializer, align 8, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!10, !11}
@@ -31,7 +31,7 @@
 !1 = !DIFile(filename: "minimal.c", directory: "/tmp")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, variable: %struct.Y* @y)
+!4 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true)
 !5 = !DICompositeType(tag: DW_TAG_structure_type, name: "Y", file: !1, line: 3, size: 64, align: 64, elements: !6)
 !6 = !{!7}
 !7 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !5, file: !1, line: 4, baseType: !8, size: 64, align: 64)
index 8294c68..e40bcff 100644 (file)
@@ -51,9 +51,9 @@
 
 %struct.C = type { i8 }
 
-@_ZN1C22static_member_variableE = global i32 0, align 4
-@global_variable = global %struct.C zeroinitializer, align 1
-@_ZN2ns25global_namespace_variableE = global i32 1, align 4
+@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !25
+@global_variable = global %struct.C zeroinitializer, align 1, !dbg !26
+@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !27
 
 define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 !dbg !3 {
 entry:
@@ -114,9 +114,9 @@ attributes #1 = { nounwind readnone }
 !22 = !DISubroutineType(types: !23)
 !23 = !{null}
 !24 = !{!25, !26, !27}
-!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, variable: i32* @_ZN1C22static_member_variableE, declaration: !10)
-!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable)
-!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11, variable: i32* @_ZN2ns25global_namespace_variableE)
+!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, declaration: !10)
+!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8)
+!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11)
 !28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29)
 !29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
 !30 = !DILocation(line: 9, scope: !3)
index 7ffa3ed..b215424 100644 (file)
@@ -33,7 +33,7 @@
 ; CHECK: DW_TAG_enumerator
 ; CHECK-NEXT: DW_AT_name{{.*}} = "X"
 
-@a = global i64 0, align 8
+@a = global i64 0, align 8, !dbg !18
 
 ; Function Attrs: nounwind uwtable
 define void @_Z4funcv() #0 !dbg !13 {
@@ -70,7 +70,7 @@ attributes #1 = { nounwind readnone }
 !15 = !DISubroutineType(types: !16)
 !16 = !{null}
 !17 = !{!18}
-!18 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !3, variable: i64* @a)
+!18 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !3)
 !19 = !{i32 2, !"Dwarf Version", i32 3}
 !20 = !DILocalVariable(name: "b", line: 4, scope: !13, file: !14, type: !21)
 !21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
index 9295595..6de5b17 100644 (file)
@@ -16,8 +16,8 @@
 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
 target triple = "arm64-apple-ios"
 
-@a = common global i32 0, align 4
-@b = common global i32 0, align 4
+@a = common global i32 0, align 4, !dbg !16
+@b = common global i32 0, align 4, !dbg !17
 
 ; Function Attrs: nounwind
 define void @f3() #0 !dbg !12 {
@@ -81,8 +81,8 @@ attributes #3 = { nounwind }
 !13 = !DISubroutineType(types: !14)
 !14 = !{null}
 !15 = !{!16, !17}
-!16 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i32* @a)
-!17 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i32* @b)
+!16 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true)
+!17 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true)
 !18 = !{i32 2, !"Dwarf Version", i32 2}
 !19 = !{i32 2, !"Debug Info Version", i32 3}
 !20 = !{!"clang version 3.8.0 (trunk 245562) (llvm/trunk 245569)"}
index a9be863..7dfa10f 100644 (file)
@@ -17,8 +17,8 @@
 ; int S::*x = 0;
 ; void (S::*y)(int) = 0;
 
-@x = global i64 -1, align 8
-@y = global { i64, i64 } zeroinitializer, align 8
+@x = global i64 -1, align 8, !dbg !5
+@y = global { i64, i64 } zeroinitializer, align 8, !dbg !10
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!16}
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 ", isOptimized: false, emissionKind: FullDebug, file: !15, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5, !10}
-!5 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i64* @x)
+!5 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "simple.cpp", directory: "/home/blaikie/Development/scratch")
 !7 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !8, extraData: !9)
 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !9 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 8, align: 8, file: !15, elements: !1)
-!10 = !DIGlobalVariable(name: "y", line: 5, isLocal: false, isDefinition: true, scope: null, file: !6, type: !11, variable: { i64, i64 }* @y)
+!10 = !DIGlobalVariable(name: "y", line: 5, isLocal: false, isDefinition: true, scope: null, file: !6, type: !11)
 !11 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !12, extraData: !9)
 !12 = !DISubroutineType(types: !13)
 !13 = !{null, !14, !8}
index 1f9fa7b..b83f7c2 100644 (file)
 ; }
 ; void B::func_fwd() {}
 
-@_ZN1A1B1iE = global i32 0, align 4
-@_ZN1A1B7var_fwdE = global i32 0, align 4
+@_ZN1A1B1iE = global i32 0, align 4, !dbg !31
+@_ZN1A1B7var_fwdE = global i32 0, align 4, !dbg !32
 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_debug_info_namespace.cpp, i8* null }]
 
 ; Function Attrs: nounwind ssp uwtable
@@ -317,8 +317,8 @@ attributes #1 = { nounwind readnone }
 !28 = !DIFile(filename: "debug-info-namespace.cpp", directory: "/tmp")
 !29 = !DISubroutineType(types: !2)
 !30 = !{!31, !32}
-!31 = !DIGlobalVariable(name: "i", linkageName: "_ZN1A1B1iE", line: 20, isLocal: false, isDefinition: true, scope: !6, file: !18, type: !13, variable: i32* @_ZN1A1B1iE)
-!32 = !DIGlobalVariable(name: "var_fwd", linkageName: "_ZN1A1B7var_fwdE", line: 44, isLocal: false, isDefinition: true, scope: !6, file: !18, type: !13, variable: i32* @_ZN1A1B7var_fwdE)
+!31 = !DIGlobalVariable(name: "i", linkageName: "_ZN1A1B1iE", line: 20, isLocal: false, isDefinition: true, scope: !6, file: !18, type: !13)
+!32 = !DIGlobalVariable(name: "var_fwd", linkageName: "_ZN1A1B7var_fwdE", line: 44, isLocal: false, isDefinition: true, scope: !6, file: !18, type: !13)
 !33 = !{!34, !35, !36, !37, !40, !41, !42, !43, !44, !45, !47, !48, !49, !51, !54, !55, !56}
 !34 = !DIImportedEntity(tag: DW_TAG_imported_module, line: 15, scope: !7, entity: !6)
 !35 = !DIImportedEntity(tag: DW_TAG_imported_module, line: 18, scope: !0, entity: !7)
index d61f494..f7864e5 100644 (file)
@@ -88,7 +88,7 @@
 
 %struct.C = type { i32 }
 
-@x = global %struct.C* null, align 8
+@x = global %struct.C* null, align 8, !dbg !27
 
 ; Function Attrs: nounwind
 define void @_Z3fn6v() #0 !dbg !14 {
@@ -225,7 +225,7 @@ attributes #3 = { nounwind }
 !24 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25)
 !25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
 !26 = !{!27}
-!27 = !DIGlobalVariable(name: "x", line: 13, isLocal: false, isDefinition: true, scope: null, file: !15, type: !25, variable: %struct.C** @x)
+!27 = !DIGlobalVariable(name: "x", line: 13, isLocal: false, isDefinition: true, scope: null, file: !15, type: !25)
 !28 = !{i32 2, !"Dwarf Version", i32 4}
 !29 = !{i32 2, !"Debug Info Version", i32 3}
 !30 = !{!"clang version 3.6.0 "}
index 31a84b8..b173b46 100644 (file)
@@ -20,7 +20,7 @@
 
 %class.bar = type { i8 }
 
-@filters = global %class.bar zeroinitializer, align 1
+@filters = global %class.bar zeroinitializer, align 1, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!36, !37}
@@ -29,7 +29,7 @@
 !1 = !DIFile(filename: "debug-info-template-recursive.cpp", directory: "/usr/local/google/home/echristo/tmp")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "filters", line: 10, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: %class.bar* @filters)
+!4 = !DIGlobalVariable(name: "filters", line: 10, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "debug-info-template-recursive.cpp", directory: "/usr/local/google/home/echristo/tmp")
 !6 = !DICompositeType(tag: DW_TAG_class_type, name: "bar", line: 9, size: 8, align: 8, file: !1, elements: !7)
 !7 = !{!8, !31}
index af71b33..0825cf1 100644 (file)
@@ -11,7 +11,7 @@
 ; };
 ; int Foo:*x = 0;
 
-@x = global i64 -1, align 8
+@x = global i64 -1, align 8, !dbg !6
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!10, !11}
@@ -22,7 +22,7 @@
 !3 = !{!4}
 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", line: 1, flags: DIFlagFwdDecl, file: !1, identifier: "_ZTS3Foo")
 !5 = !{!6}
-!6 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !7, type: !8, variable: i64* @x)
+!6 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !7, type: !8)
 !7 = !DIFile(filename: "foo.cpp", directory: ".")
 !8 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, extraData: !4)
 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
index 090dab0..45c8a16 100644 (file)
@@ -12,7 +12,7 @@
 ; CHECK-NOT: DW_AT_type
 ; CHECK: {{DW_TAG|NULL}}
 
-@y = global i8* null, align 8
+@y = global i8* null, align 8, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!8, !9}
@@ -22,7 +22,7 @@
 !1 = !DIFile(filename: "typedef.cpp", directory: "/tmp/dbginfo")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "y", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: i8** @y)
+!4 = !DIGlobalVariable(name: "y", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "typedef.cpp", directory: "/tmp/dbginfo")
 !6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !7)
 !7 = !DIDerivedType(tag: DW_TAG_typedef, name: "x", line: 1, file: !1, baseType: null)
index 31d39dc..90da75c 100644 (file)
@@ -41,7 +41,7 @@
   target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
   target triple = "x86_64-unknown-linux-gnu"
   
-  @m = common global i32 0, align 4
+  @m = common global i32 0, align 4, !dbg !16
   @.str = private unnamed_addr constant [13 x i8] c"m(main): %d\0A\00", align 1
   
   ; Function Attrs: nounwind uwtable
   !13 = !DILocalVariable(name: "argv", arg: 2, scope: !4, file: !1, line: 6, type: !8)
   !14 = !DILocalVariable(name: "n", scope: !4, file: !1, line: 7, type: !7)
   !15 = !{!16}
-  !16 = !DIGlobalVariable(name: "m", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @m)
+  !16 = !DIGlobalVariable(name: "m", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
   !17 = !{i32 2, !"Dwarf Version", i32 4}
   !18 = !{i32 2, !"Debug Info Version", i32 3}
   !19 = !{!"clang version 3.8.0 (trunk 253049)"}
index 71c32e2..83ce5b2 100644 (file)
@@ -6,7 +6,7 @@
 ; CHECK-NEXT:  info_string
 
 
-@i = common global i32 0                          ; <i32*> [#uses=2]
+@i = common global i32 0, !dbg !16                          ; <i32*> [#uses=2]
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 
@@ -45,7 +45,7 @@ entry:
 !13 = !{!14, !15}
 !14 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 10, size: 32, align: 32, file: !27, scope: !12, baseType: !5)
 !15 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 10, size: 32, align: 32, offset: 32, file: !27, scope: !12, baseType: !5)
-!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5, variable: i32* @i)
+!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5)
 !17 = !DILocation(line: 15, scope: !18)
 !18 = distinct !DILexicalBlock(line: 14, column: 0, file: !1, scope: !6)
 !19 = !DILocation(line: 9, scope: !0, inlinedAt: !17)
index fff78d4..492349c 100644 (file)
@@ -17,7 +17,7 @@
 ; CHECK-NEXT: .Laddr_sec:
 ; CHECK-NEXT: .quad tls@DTPREL+32768
 
-@tls = thread_local global i32 0, align 4
+@tls = thread_local global i32 0, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
@@ -26,7 +26,7 @@
 !1 = !DIFile(filename: "tls.cpp", directory: "/tmp")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "tls", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: i32* @tls)
+!4 = !DIGlobalVariable(name: "tls", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "tls.cpp", directory: "/tmp")
 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !{i32 2, !"Dwarf Version", i32 3}
index b813fd6..08b44e9 100644 (file)
@@ -12,7 +12,7 @@
 ; DW_OP_GNU_push_tls_address
 ; CHECK: .byte  224
 
-@tls = thread_local global i32 7, align 4
+@tls = thread_local global i32 7, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
@@ -21,7 +21,7 @@
 !1 = !DIFile(filename: "tls.cpp", directory: "/tmp")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "tls", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: i32* @tls)
+!4 = !DIGlobalVariable(name: "tls", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "tls.cpp", directory: "/tmp")
 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !{i32 2, !"Dwarf Version", i32 3}
index 62d88ca..bdab7e3 100644 (file)
@@ -3,7 +3,7 @@
 
 ; ModuleID = 'test.c'
 
-@GLB = common global i32 0, align 4
+@GLB = common global i32 0, align 4, !dbg !14
 
 define i32 @f() nounwind !dbg !5 {
   %LOC = alloca i32, align 4
@@ -27,7 +27,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 !8 = !{!9}
 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !12 = !{!14}
-!14 = !DIGlobalVariable(name: "GLB", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @GLB)
+!14 = !DIGlobalVariable(name: "GLB", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9)
 !15 = !DILocalVariable(name: "LOC", line: 4, scope: !16, file: !6, type: !9)
 !16 = distinct !DILexicalBlock(line: 3, column: 9, file: !20, scope: !5)
 !17 = !DILocation(line: 4, column: 9, scope: !16)
index 3955256..031676a 100644 (file)
@@ -11,7 +11,7 @@ target triple = "x86_64-apple-macosx"
 
 %struct.s = type opaque
 
-@i = common global %struct.s* null, align 8
+@i = common global %struct.s* null, align 8, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
@@ -20,7 +20,7 @@ target triple = "x86_64-apple-macosx"
 !1 = !DIFile(filename: "test.c", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "s", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, variable: %struct.s** @i)
+!4 = !DIGlobalVariable(name: "s", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64)
 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "s", scope: !9, file: !1, line: 1, flags: DIFlagFwdDecl)
 !7 = !{i32 2, !"Dwarf Version", i32 2}
index 6a64f5d..6650e7c 100644 (file)
@@ -42,7 +42,7 @@ source_filename = "t.cpp"
 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i386-pc-windows-msvc19.0.23918"
 
-@"\01?fptr@@3P6IHHH@ZA" = global i32 (i32, i32)* @"\01?f@@YIHHH@Z", align 4
+@"\01?fptr@@3P6IHHH@ZA" = global i32 (i32, i32)* @"\01?f@@YIHHH@Z", align 4, !dbg !4
 
 ; Function Attrs: nounwind readnone
 define x86_fastcallcc i32 @"\01?f@@YIHHH@Z"(i32 inreg %a, i32 inreg %b) #0 !dbg !12 {
@@ -67,7 +67,7 @@ attributes #1 = { nounwind readnone }
 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "fptr", linkageName: "\01?fptr@@3P6IHHH@ZA", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, variable: i32 (i32, i32)** @"\01?fptr@@3P6IHHH@ZA")
+!4 = distinct !DIGlobalVariable(name: "fptr", linkageName: "\01?fptr@@3P6IHHH@ZA", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 32, align: 32)
 !6 = !DISubroutineType(cc: DW_CC_BORLAND_msfastcall, types: !7)
 !7 = !{!8, !8, !8}
index edc1989..188b862 100644 (file)
@@ -10,7 +10,7 @@
 ; CHECK: DW_AT_specification {{.*}} "_ZN3foo3barEv"
 
 
-@_ZZN3foo3barEvE1x = constant i32 0, align 4
+@_ZZN3foo3barEvE1x = constant i32 0, align 4, !dbg !20
 
 define void @_ZN3foo3barEv()  !dbg !5 {
 entry:
@@ -32,7 +32,7 @@ entry:
 !12 = !DICompositeType(tag: DW_TAG_class_type, name: "foo", line: 1, size: 8, align: 8, file: !27, elements: !13)
 !13 = !{!11}
 !18 = !{!20}
-!20 = !DIGlobalVariable(name: "x", line: 5, isLocal: true, isDefinition: true, scope: !5, file: !6, type: !21, variable: i32* @_ZZN3foo3barEvE1x)
+!20 = !DIGlobalVariable(name: "x", line: 5, isLocal: true, isDefinition: true, scope: !5, file: !6, type: !21)
 !21 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !22)
 !22 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !25 = !DILocation(line: 6, column: 1, scope: !26)
index 5ce75cb..016bc26 100644 (file)
@@ -12,8 +12,8 @@
 %class.A = type { i32 }
 %class.B = type { i32 }
 
-@a = global %class.A zeroinitializer, align 4
-@b = global %class.B zeroinitializer, align 4
+@a = global %class.A zeroinitializer, align 4, !dbg !5
+@b = global %class.B zeroinitializer, align 4, !dbg !17
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!29}
@@ -21,7 +21,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 (trunk 153413) (llvm/trunk 153428)", isOptimized: false, emissionKind: FullDebug, file: !28, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5, !17}
-!5 = !DIGlobalVariable(name: "a", line: 10, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %class.A* @a)
+!5 = !DIGlobalVariable(name: "a", line: 10, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "foo.cpp", directory: "/Users/echristo/tmp")
 !7 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 1, size: 32, align: 32, file: !28, elements: !8)
 !8 = !{!9, !11}
@@ -31,7 +31,7 @@
 !12 = !DISubroutineType(types: !13)
 !13 = !{null, !14}
 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !7)
-!17 = !DIGlobalVariable(name: "b", line: 11, isLocal: false, isDefinition: true, scope: null, file: !6, type: !18, variable: %class.B* @b)
+!17 = !DIGlobalVariable(name: "b", line: 11, isLocal: false, isDefinition: true, scope: null, file: !6, type: !18)
 !18 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 5, size: 32, align: 32, file: !28, elements: !19)
 !19 = !{!20, !21, !27}
 !20 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 7, size: 32, align: 32, flags: DIFlagPrivate, file: !28, scope: !18, baseType: !10)
index e70be4c..c95a7e0 100644 (file)
@@ -6,7 +6,7 @@
 ; CHECK-NEXT:  info_string
  
 
-@i = common global i32 0                          ; <i32*> [#uses=2]
+@i = common global i32 0, !dbg !16                          ; <i32*> [#uses=2]
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 
@@ -45,7 +45,7 @@ entry:
 !13 = !{!14, !15}
 !14 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 10, size: 32, align: 32, file: !27, scope: !12, baseType: !5)
 !15 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 10, size: 32, align: 32, offset: 32, file: !27, scope: !12, baseType: !5)
-!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5, variable: i32* @i)
+!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5)
 !17 = !DILocation(line: 15, scope: !18)
 !18 = distinct !DILexicalBlock(line: 14, column: 0, file: !1, scope: !6)
 !19 = !DILocation(line: 9, scope: !0, inlinedAt: !17)
index b195eaf..c930782 100644 (file)
@@ -31,7 +31,7 @@ target triple = "x86_64-apple-macosx10.11.0"
 
 %struct.S0 = type { i16, i32 }
 
-@a = common global %struct.S0 zeroinitializer, align 4
+@a = common global %struct.S0 zeroinitializer, align 4, !dbg !21
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata)
 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
@@ -84,7 +84,7 @@ entry:
 !18 = !DISubroutineType(types: !19)
 !19 = !{!15}
 !20 = !{!21}
-!21 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 4, type: !11, isLocal: false, isDefinition: true, variable: %struct.S0* @a)
+!21 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 4, type: !11, isLocal: false, isDefinition: true)
 !22 = !{i32 2, !"Dwarf Version", i32 2}
 !23 = !{i32 2, !"Debug Info Version", i32 3}
 !24 = !{i32 1, !"PIC Level", i32 2}
index 891429e..a56634c 100644 (file)
@@ -10,7 +10,7 @@
 target triple = "x86_64-linux-gnu"
 
 @_ZTId = external constant i8*
-@zed = global [1 x void ()*] [void ()* @bar]
+@zed = global [1 x void ()*] [void ()* @bar], !dbg !11
 
 define void @foo() !dbg !4 {
   ret void
@@ -42,7 +42,7 @@ lpad:                                             ; preds = %0
 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !9 = distinct !DISubprogram(name: "bar_d", linkageName: "bar", scope: !5, file: !5, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
 !10 = !{!11}
-!11 = !DIGlobalVariable(name: "zed", scope: !0, file: !5, line: 6, type: !12, isLocal: false, isDefinition: true, variable: [1 x void ()*]* @zed)
+!11 = !DIGlobalVariable(name: "zed", scope: !0, file: !5, line: 6, type: !12, isLocal: false, isDefinition: true)
 !12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 64, align: 64, elements: !15)
 !13 = !DIDerivedType(tag: DW_TAG_typedef, name: "vifunc", file: !5, line: 5, baseType: !14)
 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, align: 64)
index 322459a..54156d6 100644 (file)
@@ -22,7 +22,7 @@
 
 %struct.foo = type { i8 }
 
-@f = global %struct.foo zeroinitializer, align 1
+@f = global %struct.foo zeroinitializer, align 1, !dbg !10
 @i = external global i32
 
 !llvm.dbg.cu = !{!0}
@@ -39,7 +39,7 @@
 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !9 = !{!10}
-!10 = !DIGlobalVariable(name: "f", line: 6, isLocal: false, isDefinition: true, scope: null, file: !11, type: !4, variable: %struct.foo* @f)
+!10 = !DIGlobalVariable(name: "f", line: 6, isLocal: false, isDefinition: true, scope: null, file: !11, type: !4)
 !11 = !DIFile(filename: "simple.cpp", directory: "/tmp/dbginfo")
 !12 = !{i32 2, !"Dwarf Version", i32 4}
 !13 = !{i32 1, !"Debug Info Version", i32 3}
index 5275fc6..a4ee76f 100644 (file)
@@ -21,7 +21,7 @@ target triple = "x86_64-apple-macosx"
 
 %struct.PackedBits = type <{ i8, i32 }>
 
-@s = common global %struct.PackedBits zeroinitializer, align 1
+@s = common global %struct.PackedBits zeroinitializer, align 1, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!14, !15, !16}
@@ -31,7 +31,7 @@ target triple = "x86_64-apple-macosx"
 !1 = !DIFile(filename: "bitfield.c", directory: "/Volumes/Data/llvm")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "s", scope: !0, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, variable: %struct.PackedBits* @s)
+!4 = distinct !DIGlobalVariable(name: "s", scope: !0, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true)
 !5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "PackedBits", file: !1, line: 3, size: 40, align: 8, elements: !6)
 !6 = !{!7, !9, !13}
 
index 1011558..9380ed4 100644 (file)
@@ -48,7 +48,7 @@ target triple = "x86_64-apple-macosx"
 
 %struct.bitfield = type <{ i8, [3 x i8], i64 }>
 
-@b = common global %struct.bitfield zeroinitializer, align 4
+@b = common global %struct.bitfield zeroinitializer, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13, !14, !15}
@@ -58,7 +58,7 @@ target triple = "x86_64-apple-macosx"
 !1 = !DIFile(filename: "bitfields.c", directory: "/")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "b", scope: !0, file: !5, line: 8, type: !6, isLocal: false, isDefinition: true, variable: %struct.bitfield* @b)
+!4 = !DIGlobalVariable(name: "b", scope: !0, file: !5, line: 8, type: !6, isLocal: false, isDefinition: true)
 !5 = !DIFile(filename: "bitfields.c", directory: "/")
 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "bitfield", file: !5, line: 1, size: 96, align: 32, elements: !7)
 !7 = !{!8, !10, !11, !12}
index 37cb3d5..282937b 100644 (file)
@@ -11,7 +11,7 @@
 
 %struct.foo = type {}
 
-@f = common global %struct.foo zeroinitializer, align 1
+@f = common global %struct.foo zeroinitializer, align 1, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
@@ -21,7 +21,7 @@
 !1 = !DIFile(filename: "simple.c", directory: "/tmp/dbginfo")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "f", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: %struct.foo* @f)
+!4 = !DIGlobalVariable(name: "f", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "simple.c", directory: "/tmp/dbginfo")
 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, align: 8, file: !1, elements: !2)
 !7 = !{i32 2, !"Dwarf Version", i32 4}
index 47b2e5f..de06a88 100644 (file)
@@ -118,7 +118,7 @@ declare void @_Z8moz_freePv(i8*)
 !45 = !DILocalVariable(name: "this", line: 4, arg: 1, flags: DIFlagArtificial, scope: !31, file: !6, type: !34)
 !46 = !DILocalVariable(name: "aValue", line: 4, arg: 2, scope: !31, file: !6, type: !9)
 !47 = !{!49}
-!49 = !DIGlobalVariable(name: "mRefCnt", line: 9, isLocal: false, isDefinition: true, scope: null, file: !6, type: !37, variable: i32* null)
+!49 = !DIGlobalVariable(name: "mRefCnt", line: 9, isLocal: false, isDefinition: true, scope: null, file: !6, type: !37)
 !50 = !DILocation(line: 5, column: 5, scope: !51, inlinedAt: !52)
 !51 = distinct !DILexicalBlock(line: 4, column: 29, file: !6, scope: !31)
 !52 = !DILocation(line: 15, scope: !53)
index 163d933..13652a5 100644 (file)
@@ -20,7 +20,7 @@
 
 %class.A = type { i32 }
 
-@a = global %class.A zeroinitializer, align 4
+@a = global %class.A zeroinitializer, align 4, !dbg !22
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
 
 define internal void @__cxx_global_var_init() section ".text.startup" !dbg !14 {
@@ -81,7 +81,7 @@ attributes #1 = { nounwind readnone }
 !19 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__I_a", line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !15, type: !20, variables: !2)
 !20 = !DISubroutineType(types: !2)
 !21 = !{!22}
-!22 = !DIGlobalVariable(name: "a", line: 8, isLocal: false, isDefinition: true, scope: null, file: !15, type: !4, variable: %class.A* @a)
+!22 = !DIGlobalVariable(name: "a", line: 8, isLocal: false, isDefinition: true, scope: null, file: !15, type: !4)
 !23 = !{i32 2, !"Dwarf Version", i32 4}
 !24 = !{i32 1, !"Debug Info Version", i32 3}
 !25 = !{!"clang version 3.5 (trunk 199923) (llvm/trunk 199940)"}
index eea636b..fe021e4 100644 (file)
@@ -28,7 +28,7 @@
 
 %struct.foo = type { i8, i32 }
 
-@f = global %struct.foo zeroinitializer, align 4
+@f = global %struct.foo zeroinitializer, align 4, !dbg !11
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13, !15}
@@ -45,7 +45,7 @@
 !8 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 3, size: 32, align: 32, offset: 32, file: !1, scope: !4, baseType: !9)
 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !10 = !{!11}
-!11 = !DIGlobalVariable(name: "f", line: 6, isLocal: false, isDefinition: true, scope: null, file: !12, type: !4, variable: %struct.foo* @f)
+!11 = !DIGlobalVariable(name: "f", line: 6, isLocal: false, isDefinition: true, scope: null, file: !12, type: !4)
 !12 = !DIFile(filename: "data_member_location.cpp", directory: "/tmp/dbginfo")
 !13 = !{i32 2, !"Dwarf Version", i32 4}
 !14 = !{!"clang version 3.4 "}
index 6c69053..aa733ac 100644 (file)
@@ -3,7 +3,7 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.7.2"
 
-@s = common global [4294967296 x i8] zeroinitializer, align 16
+@s = common global [4294967296 x i8] zeroinitializer, align 16, !dbg !13
 ; CHECK: .quad 4294967296 ## DW_AT_count
 
 define void @bar() nounwind uwtable ssp !dbg !5 {
@@ -22,7 +22,7 @@ entry:
 !7 = !DISubroutineType(types: !8)
 !8 = !{null}
 !11 = !{!13}
-!13 = !DIGlobalVariable(name: "s", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !14, variable: [4294967296 x i8]* @s)
+!13 = !DIGlobalVariable(name: "s", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !14)
 !14 = !DICompositeType(tag: DW_TAG_array_type, size: 34359738368, align: 8, baseType: !15, elements: !16)
 !15 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
 !16 = !{!17}
index f647d60..7db2582 100644 (file)
@@ -41,7 +41,7 @@
 
 %struct.S1 = type { float*, i32 }
 
-@p = common global %struct.S1 zeroinitializer, align 8
+@p = common global %struct.S1 zeroinitializer, align 8, !dbg !19
 
 define i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp !dbg !0 {
 entry:
@@ -93,7 +93,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
 !16 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
 !17 = !DIDerivedType(tag: DW_TAG_member, name: "nums", line: 3, size: 32, align: 32, offset: 64, file: !42, scope: !1, baseType: !5)
 !18 = !DILocalVariable(name: "nums", line: 7, arg: 2, scope: !0, file: !1, type: !5)
-!19 = !DIGlobalVariable(name: "p", line: 14, isLocal: false, isDefinition: true, scope: !2, file: !1, type: !11, variable: %struct.S1* @p)
+!19 = !DIGlobalVariable(name: "p", line: 14, isLocal: false, isDefinition: true, scope: !2, file: !1, type: !11)
 !20 = !DILocation(line: 7, column: 13, scope: !0)
 !21 = !DILocation(line: 7, column: 21, scope: !0)
 !22 = !DILocation(line: 9, column: 3, scope: !23)
index 31a0658..048c98d 100644 (file)
@@ -36,7 +36,7 @@
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc18.0.0"
 
-@x = common global i32 0, align 4
+@x = common global i32 0, align 4, !dbg !15
 
 ; Function Attrs: nounwind uwtable
 define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !4 {
@@ -89,7 +89,7 @@ attributes #3 = { nounwind }
 !12 = !DILocalVariable(name: "argv", arg: 2, scope: !4, file: !1, line: 4, type: !8)
 !13 = !DILocalVariable(name: "argc", arg: 1, scope: !4, file: !1, line: 4, type: !7)
 !14 = !{!15}
-!15 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !16, isLocal: false, isDefinition: true, variable: i32* @x)
+!15 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !16, isLocal: false, isDefinition: true)
 !16 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
 !17 = !{i32 2, !"Dwarf Version", i32 4}
 !18 = !{i32 2, !"Debug Info Version", i32 3}
index f3ed35b..fa0752d 100644 (file)
@@ -91,9 +91,9 @@ target triple = "x86_64-apple-macosx10.10.0"
 %class.B = type { i8 }
 %union.U = type { i32 }
 
-@a = global %struct.A zeroinitializer, align 1
-@b = global %class.B zeroinitializer, align 1
-@u = global %union.U zeroinitializer, align 4
+@a = global %struct.A zeroinitializer, align 1, !dbg !35
+@b = global %class.B zeroinitializer, align 1, !dbg !36
+@u = global %union.U zeroinitializer, align 4, !dbg !37
 
 ; Function Attrs: nounwind ssp uwtable
 define void @_Z4freev() #0 !dbg !30 {
@@ -140,9 +140,9 @@ attributes #0 = { nounwind ssp uwtable }
 !32 = !DISubroutineType(types: !33)
 !33 = !{null}
 !34 = !{!35, !36, !37}
-!35 = !DIGlobalVariable(name: "a", line: 37, isLocal: false, isDefinition: true, scope: null, file: !31, type: !4, variable: %struct.A* @a)
-!36 = !DIGlobalVariable(name: "b", line: 38, isLocal: false, isDefinition: true, scope: null, file: !31, type: !12, variable: %class.B* @b)
-!37 = !DIGlobalVariable(name: "u", line: 39, isLocal: false, isDefinition: true, scope: null, file: !31, type: !22, variable: %union.U* @u)
+!35 = !DIGlobalVariable(name: "a", line: 37, isLocal: false, isDefinition: true, scope: null, file: !31, type: !4)
+!36 = !DIGlobalVariable(name: "b", line: 38, isLocal: false, isDefinition: true, scope: null, file: !31, type: !12)
+!37 = !DIGlobalVariable(name: "u", line: 39, isLocal: false, isDefinition: true, scope: null, file: !31, type: !22)
 !38 = !{i32 2, !"Dwarf Version", i32 2}
 !39 = !{i32 2, !"Debug Info Version", i32 3}
 !40 = !{!"clang version 3.6.0 "}
index d041cf3..4ed3583 100644 (file)
@@ -139,10 +139,10 @@ target triple = "x86_64-apple-darwin"
 ; CHECK:          DW_AT_bit_offset {{.*}} (0x1f)
 ; CHECK:          DW_AT_data_member_location {{.*}}0c
 
-@l0 = common global %struct.layout0 zeroinitializer, align 8
-@l1 = common global %struct.layout1 zeroinitializer, align 4
-@l2 = common global %struct.layout2 zeroinitializer, align 1
-@l3 = common global %struct.layout3 zeroinitializer, align 4
+@l0 = common global %struct.layout0 zeroinitializer, align 8, !dbg !4
+@l1 = common global %struct.layout1 zeroinitializer, align 4, !dbg !18
+@l2 = common global %struct.layout2 zeroinitializer, align 1, !dbg !25
+@l3 = common global %struct.layout3 zeroinitializer, align 4, !dbg !35
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!45, !46}
@@ -152,7 +152,7 @@ target triple = "x86_64-apple-darwin"
 !1 = !DIFile(filename: "/llvm/tools/clang/test/CodeGen/<stdin>", directory: "/llvm/_build.ninja.release")
 !2 = !{}
 !3 = !{!4, !18, !25, !35}
-!4 = !DIGlobalVariable(name: "l0", scope: !0, file: !5, line: 88, type: !6, isLocal: false, isDefinition: true, variable: %struct.layout0* @l0)
+!4 = !DIGlobalVariable(name: "l0", scope: !0, file: !5, line: 88, type: !6, isLocal: false, isDefinition: true)
 !5 = !DIFile(filename: "/llvm/tools/clang/test/CodeGen/debug-info-packed-struct.c", directory: "/llvm/_build.ninja.release")
 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout0", file: !5, line: 15, size: 192, align: 64, elements: !7)
 !7 = !{!8, !10, !17}
@@ -166,14 +166,14 @@ target triple = "x86_64-apple-darwin"
 !15 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !11, file: !5, line: 13, baseType: !16, size: 60, offset: 4)
 !16 = !DIBasicType(name: "long long int", size: 64, align: 64, encoding: DW_ATE_signed)
 !17 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16", scope: !6, file: !5, line: 18, baseType: !14, size: 1, align: 32, offset: 128)
-!18 = !DIGlobalVariable(name: "l1", scope: !0, file: !5, line: 89, type: !19, isLocal: false, isDefinition: true, variable: %struct.layout1* @l1)
+!18 = !DIGlobalVariable(name: "l1", scope: !0, file: !5, line: 89, type: !19, isLocal: false, isDefinition: true)
 !19 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout1", file: !5, line: 34, size: 96, align: 32, elements: !20)
 !20 = !{!21, !22, !24}
 !21 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs0", scope: !19, file: !5, line: 35, baseType: !9, size: 8, align: 8)
 !22 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1", scope: !19, file: !5, line: 36, baseType: !23, size: 64, align: 8, offset: 8)
 !23 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_anon", file: !5, line: 30, size: 64, align: 8, elements: !2)
 !24 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9", scope: !19, file: !5, line: 37, baseType: !14, size: 1, align: 32, offset: 72)
-!25 = !DIGlobalVariable(name: "l2", scope: !0, file: !5, line: 90, type: !26, isLocal: false, isDefinition: true, variable: %struct.layout2* @l2)
+!25 = !DIGlobalVariable(name: "l2", scope: !0, file: !5, line: 90, type: !26, isLocal: false, isDefinition: true)
 !26 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout2", file: !5, line: 54, size: 80, align: 8, elements: !27)
 !27 = !{!28, !29, !34}
 !28 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs0", scope: !26, file: !5, line: 55, baseType: !9, size: 8, align: 8)
@@ -183,7 +183,7 @@ target triple = "x86_64-apple-darwin"
 !32 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !30, file: !5, line: 51, baseType: !14, size: 4, align: 32)
 !33 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !30, file: !5, line: 52, baseType: !16, size: 60, offset: 4)
 !34 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9", scope: !26, file: !5, line: 57, baseType: !14, size: 1, align: 32, offset: 72)
-!35 = !DIGlobalVariable(name: "l3", scope: !0, file: !5, line: 91, type: !36, isLocal: false, isDefinition: true, variable: %struct.layout3* @l3)
+!35 = !DIGlobalVariable(name: "l3", scope: !0, file: !5, line: 91, type: !36, isLocal: false, isDefinition: true)
 !36 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout3", file: !5, line: 76, size: 128, align: 32, elements: !37)
 !37 = !{!38, !39, !44}
 !38 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs0", scope: !36, file: !5, line: 77, baseType: !9, size: 8, align: 8)
index cbe5117..017501e 100644 (file)
@@ -38,9 +38,9 @@
 
 %class.C = type { i32 }
 
-@_ZN1C1aE = global i32 4, align 4
-@_ZN1C1bE = global i32 2, align 4
-@_ZN1C1cE = global i32 1, align 4
+@_ZN1C1aE = global i32 4, align 4, !dbg !12
+@_ZN1C1bE = global i32 2, align 4, !dbg !27
+@_ZN1C1cE = global i32 1, align 4, !dbg !28
 
 define i32 @main() nounwind uwtable !dbg !5 {
 entry:
@@ -67,7 +67,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 !8 = !{!9}
 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !10 = !{!12, !27, !28}
-!12 = !DIGlobalVariable(name: "a", linkageName: "_ZN1C1aE", line: 14, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @_ZN1C1aE, declaration: !15)
+!12 = !DIGlobalVariable(name: "a", linkageName: "_ZN1C1aE", line: 14, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, declaration: !15)
 !13 = !DICompositeType(tag: DW_TAG_class_type, name: "C", line: 1, size: 32, align: 32, file: !33, elements: !14)
 !14 = !{!15, !16, !19, !20, !23, !24, !26}
 !15 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 3, flags: DIFlagPrivate | DIFlagStaticMember, file: !33, scope: !13, baseType: !9)
@@ -82,8 +82,8 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 !24 = !DIDerivedType(tag: DW_TAG_member, name: "const_c", line: 10, flags: DIFlagPublic | DIFlagStaticMember, file: !33, scope: !13, baseType: !25, extraData: i32 18)
 !25 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !9)
 !26 = !DIDerivedType(tag: DW_TAG_member, name: "d", line: 11, size: 32, align: 32, flags: DIFlagPublic, file: !33, scope: !13, baseType: !9)
-!27 = !DIGlobalVariable(name: "b", linkageName: "_ZN1C1bE", line: 15, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @_ZN1C1bE, declaration: !19)
-!28 = !DIGlobalVariable(name: "c", linkageName: "_ZN1C1cE", line: 16, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @_ZN1C1cE, declaration: !23)
+!27 = !DIGlobalVariable(name: "b", linkageName: "_ZN1C1bE", line: 15, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, declaration: !19)
+!28 = !DIGlobalVariable(name: "c", linkageName: "_ZN1C1cE", line: 16, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, declaration: !23)
 !29 = !DILocalVariable(name: "instance_C", line: 20, scope: !5, file: !6, type: !13)
 !30 = !DILocation(line: 20, scope: !5)
 !31 = !DILocation(line: 21, scope: !5)
index 9a6b6aa..905e35b 100644 (file)
 ; ModuleID = 'frame.c'
 source_filename = "frame.c"
 
-@data = global i32 17, align 4
-@sum = local_unnamed_addr global i32 0, align 4
-@zero = local_unnamed_addr global i32 0, align 4
-@ptr = common local_unnamed_addr global i32* null, align 8
+@data = global i32 17, align 4, !dbg !4
+@sum = local_unnamed_addr global i32 0, align 4, !dbg !6
+@zero = local_unnamed_addr global i32 0, align 4, !dbg !7
+@ptr = common local_unnamed_addr global i32* null, align 8, !dbg !8
 
 ; Function Attrs: nounwind uwtable
 define i32 @main() local_unnamed_addr !dbg !13 {
@@ -83,11 +83,11 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
 !1 = !DIFile(filename: "frame.c", directory: "/home/user/test")
 !2 = !{}
 !3 = !{!4, !6, !7, !8}
-!4 = distinct !DIGlobalVariable(name: "data", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @data)
+!4 = distinct !DIGlobalVariable(name: "data", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!6 = distinct !DIGlobalVariable(name: "sum", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, variable: i32* @sum)
-!7 = distinct !DIGlobalVariable(name: "zero", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, variable: i32* @zero)
-!8 = distinct !DIGlobalVariable(name: "ptr", scope: !0, file: !1, line: 4, type: !9, isLocal: false, isDefinition: true, variable: i32** @ptr)
+!6 = distinct !DIGlobalVariable(name: "sum", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true)
+!7 = distinct !DIGlobalVariable(name: "zero", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true)
+!8 = distinct !DIGlobalVariable(name: "ptr", scope: !0, file: !1, line: 4, type: !9, isLocal: false, isDefinition: true)
 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64, align: 64)
 !10 = !{i32 2, !"Dwarf Version", i32 4}
 !11 = !{i32 2, !"Debug Info Version", i32 3}
index 3c9288b..9e82c49 100644 (file)
@@ -27,7 +27,7 @@
 ; SCE-NOT: apple_names
 
 
-@globalvar = global i32 0, align 4
+@globalvar = global i32 0, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!6, !7}
@@ -37,7 +37,7 @@
 !1 = !DIFile(filename: "debugger-tune.cpp", directory: "/home/probinson/projects/scratch")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "globalvar", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @globalvar)
+!4 = !DIGlobalVariable(name: "globalvar", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !6 = !{i32 2, !"Dwarf Version", i32 4}
 !7 = !{i32 2, !"Debug Info Version", i32 3}
index 730af85..fec59f9 100644 (file)
@@ -28,7 +28,7 @@ $_ZN3fooD2Ev = comdat any
 
 $_ZN4baseC2Ev = comdat any
 
-@f = global %struct.foo zeroinitializer, align 8
+@f = global %struct.foo zeroinitializer, align 8, !dbg !29
 @__dso_handle = external global i8
 @_ZTV4base = external unnamed_addr constant [4 x i8*]
 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_decl_derived_member.cpp, i8* null }]
@@ -128,7 +128,7 @@ attributes #4 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
 !26 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__sub_I_decl_derived_member.cpp", isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, file: !1, scope: !11, type: !27, variables: !2)
 !27 = !DISubroutineType(types: !2)
 !28 = !{!29}
-!29 = !DIGlobalVariable(name: "f", line: 8, isLocal: false, isDefinition: true, scope: null, file: !11, type: !4, variable: %struct.foo* @f)
+!29 = !DIGlobalVariable(name: "f", line: 8, isLocal: false, isDefinition: true, scope: null, file: !11, type: !4)
 !30 = !{i32 2, !"Dwarf Version", i32 4}
 !31 = !{i32 2, !"Debug Info Version", i32 3}
 !32 = !{!"clang version 3.7.0 (trunk 227104) (llvm/trunk 227103)"}
index 60c3116..b809a9d 100644 (file)
@@ -5,7 +5,7 @@
 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i686-pc-windows-msvc"
 
-@"\01?id@?$numpunct@D@@0HA" = available_externally dllimport global i32 0, align 4
+@"\01?id@?$numpunct@D@@0HA" = available_externally dllimport global i32 0, align 4, !dbg !4
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13, !14}
@@ -14,7 +14,7 @@ target triple = "i686-pc-windows-msvc"
 !1 = !DIFile(filename: "/usr/local/google/home/majnemer/Downloads/<stdin>", directory: "/usr/local/google/home/majnemer/llvm/src")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "id", linkageName: "\01?id@?$numpunct@D@@0HA", scope: !0, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, variable: i32* @"\01?id@?$numpunct@D@@0HA", declaration: !7)
+!4 = distinct !DIGlobalVariable(name: "id", linkageName: "\01?id@?$numpunct@D@@0HA", scope: !0, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, declaration: !7)
 !5 = !DIFile(filename: "/usr/local/google/home/majnemer/Downloads/t.ii", directory: "/usr/local/google/home/majnemer/llvm/src")
 !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !DIDerivedType(tag: DW_TAG_member, name: "id", scope: !8, file: !5, line: 2, baseType: !6, flags: DIFlagStaticMember)
index d9eb0ec..6be5d61 100644 (file)
@@ -23,7 +23,7 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@global = global i32 2, align 4
+@global = global i32 2, align 4, !dbg !18
 
 ; Function Attrs: nounwind readnone uwtable
 define i32 @_Z3fooi(i32 %bar) #0 !dbg !4 {
@@ -77,7 +77,7 @@ attributes #2 = { nounwind readnone }
 !15 = !DISubroutineType(types: !16)
 !16 = !{!8}
 !17 = !{!18}
-!18 = !DIGlobalVariable(name: "global", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @global)
+!18 = !DIGlobalVariable(name: "global", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8)
 !19 = !{i32 2, !"Dwarf Version", i32 4}
 !20 = !DILocation(line: 2, scope: !4)
 !21 = !DILocation(line: 3, scope: !11)
index 2ec2467..d736b50 100644 (file)
@@ -44,9 +44,9 @@
 
 target triple = "x86_64-unknown-linux-gnu"
 
-@some_data = global i32 4, align 4
-@some_other = global i32 5, section "strange+section", align 4
-@some_bss = common global i32 0, align 4
+@some_data = global i32 4, align 4, !dbg !9
+@some_other = global i32 5, section "strange+section", align 4, !dbg !11
+@some_bss = common global i32 0, align 4, !dbg !12
 
 define void @some_code() !dbg !4 {
 entry:
@@ -70,10 +70,10 @@ entry:
 !6 = !DISubroutineType(types: !7)
 !7 = !{null}
 !8 = !{!9, !11, !12}
-!9 = !DIGlobalVariable(name: "some_data", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10, variable: i32* @some_data)
+!9 = !DIGlobalVariable(name: "some_data", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10)
 !10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!11 = !DIGlobalVariable(name: "some_other", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10, variable: i32* @some_other)
-!12 = !DIGlobalVariable(name: "some_bss", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10, variable: i32* @some_bss)
+!11 = !DIGlobalVariable(name: "some_other", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10)
+!12 = !DIGlobalVariable(name: "some_bss", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10)
 !13 = !{i32 2, !"Dwarf Version", i32 4}
 !14 = !DILocation(line: 7, scope: !4)
 !15 = !DILocation(line: 8, scope: !4)
index 9e89ee9..a4437aa 100644 (file)
@@ -38,7 +38,7 @@
 ; NOLINKAGE-NOT: .asciz   "_ZN4test10global_varE"
 ; NOLINKAGE-NOT: .asciz   "_ZN4test3barEv"
 
-@_ZN4test10global_varE = global i32 0, align 4
+@_ZN4test10global_varE = global i32 0, align 4, !dbg !10
 
 ; Function Attrs: nounwind uwtable
 define i32 @_ZN4test3barEv() #0 !dbg !4 {
@@ -62,7 +62,7 @@ attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fp
 !7 = !{!8}
 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !9 = !{!10}
-!10 = !DIGlobalVariable(name: "global_var", linkageName: "_ZN4test10global_varE", scope: !5, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, variable: i32* @_ZN4test10global_varE)
+!10 = !DIGlobalVariable(name: "global_var", linkageName: "_ZN4test10global_varE", scope: !5, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true)
 !11 = !{i32 2, !"Dwarf Version", i32 4}
 !12 = !{i32 2, !"Debug Info Version", i32 3}
 !13 = !{!"clang version 3.8.0 (trunk 244662)"}
index e6cdd7b..70fdb5b 100644 (file)
@@ -57,9 +57,9 @@
 
 %struct.C = type { i8 }
 
-@_ZN1C22static_member_variableE = global i32 0, align 4
-@global_variable = global %struct.C zeroinitializer, align 1
-@_ZN2ns25global_namespace_variableE = global i32 1, align 4
+@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !25
+@global_variable = global %struct.C zeroinitializer, align 1, !dbg !26
+@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !27
 
 define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 !dbg !3 {
 entry:
@@ -120,9 +120,9 @@ attributes #1 = { nounwind readnone }
 !22 = !DISubroutineType(types: !23)
 !23 = !{null}
 !24 = !{!25, !26, !27}
-!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, variable: i32* @_ZN1C22static_member_variableE, declaration: !10)
-!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable)
-!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11, variable: i32* @_ZN2ns25global_namespace_variableE)
+!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, declaration: !10)
+!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8)
+!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11)
 !28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29)
 !29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
 !30 = !DILocation(line: 9, scope: !3)
index e927f9f..7c3cdc0 100644 (file)
@@ -4,7 +4,7 @@
 
 %class.A = type { [0 x i32] }
 
-@a = global %class.A zeroinitializer, align 4
+@a = global %class.A zeroinitializer, align 4, !dbg !5
 
 ; CHECK: DW_TAG_class_type
 ; CHECK:      DW_TAG_member
@@ -30,7 +30,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 169136)", isOptimized: false, emissionKind: FullDebug, file: !20, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %class.A* @a)
+!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "t.cpp", directory: "/Volumes/Sandbox/llvm")
 !7 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 1, align: 32, file: !20, elements: !8)
 !8 = !{!9, !14}
index eaf43d2..247215d 100644 (file)
@@ -1,9 +1,9 @@
 ; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
-@a = global i32 0, align 4
-@b = global i64 0, align 8
-@c = global i32 0, align 4
+@a = global i32 0, align 4, !dbg !19
+@b = global i64 0, align 8, !dbg !20
+@c = global i32 0, align 4, !dbg !21
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!23}
@@ -24,9 +24,9 @@
 !14 = !DIEnumerator(name: "C1", value: 1) ; [ DW_TAG_enumerator ]
 !15 = !{}
 !17 = !{!19, !20, !21}
-!19 = !DIGlobalVariable(name: "a", line: 4, isLocal: false, isDefinition: true, scope: null, file: !4, type: !3, variable: i32* @a)
-!20 = !DIGlobalVariable(name: "b", line: 5, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: i64* @b)
-!21 = !DIGlobalVariable(name: "c", line: 6, isLocal: false, isDefinition: true, scope: null, file: !4, type: !12, variable: i32* @c)
+!19 = !DIGlobalVariable(name: "a", line: 4, isLocal: false, isDefinition: true, scope: null, file: !4, type: !3)
+!20 = !DIGlobalVariable(name: "b", line: 5, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8)
+!21 = !DIGlobalVariable(name: "c", line: 6, isLocal: false, isDefinition: true, scope: null, file: !4, type: !12)
 !22 = !DIFile(filename: "foo.cpp", directory: "/Users/echristo/tmp")
 
 ; CHECK: DW_TAG_enumeration_type [{{.*}}]
index c01f513..e05e105 100644 (file)
@@ -1,7 +1,7 @@
 ; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
-@e = global i16 0, align 2
+@e = global i16 0, align 2, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!9}
@@ -9,7 +9,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.2 (trunk 165274) (llvm/trunk 165272)", isOptimized: false, emissionKind: FullDebug, file: !8, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "e", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i16* @e)
+!5 = !DIGlobalVariable(name: "e", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "foo.cpp", directory: "/tmp")
 !7 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E", line: 1, size: 16, align: 16, flags: DIFlagFwdDecl, file: !8)
 !8 = !DIFile(filename: "foo.cpp", directory: "/tmp")
index 7d89559..1bc69a9 100644 (file)
@@ -26,7 +26,7 @@ target triple = "x86_64-apple-macosx10.10.0"
 
 %class.A = type opaque
 
-@a = global %class.A* null, align 8
+@a = global %class.A* null, align 8, !dbg !6
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13, !14, !15}
@@ -38,7 +38,7 @@ target triple = "x86_64-apple-macosx10.10.0"
 !3 = !{!4, !9}
 !4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", file: !1, flags: DIFlagExternalTypeRef, identifier: "_ZTS1A")
 !5 = !{!6}
-!6 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: %class.A** @a)
+!6 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64)
 !8 = !DICompositeType(tag: DW_TAG_class_type, name: "B", file: !1, flags: DIFlagExternalTypeRef, identifier: "_ZTS1B")
 !9 = !DICompositeType(tag: DW_TAG_class_type, name: "A", file: !1, flags: DIFlagExternalTypeRef, identifier: "_ZTSN1N1BE")
index 96bb6e2..8d1e2f9 100644 (file)
@@ -3,7 +3,7 @@
 ; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s
 ; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
 
-@a = common global i32 0, align 4
+@a = common global i32 0, align 4, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!9}
@@ -11,7 +11,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)", isOptimized: false, splitDebugFilename: "baz.dwo", emissionKind: FullDebug, file: !8, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i32* @a)
+!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "baz.c", directory: "/usr/local/google/home/echristo/tmp")
 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !8 = !DIFile(filename: "baz.c", directory: "/usr/local/google/home/echristo/tmp")
index a2ee2b9..f8a7a29 100644 (file)
 %struct.anon = type { i32, i32 }
 %struct.baz = type { i8 }
 
-@b = global %struct.bar zeroinitializer, align 1
-@_ZN7echidna8capybara8mongoose6animalE = global %"class.echidna::capybara::mongoose::fluffy" zeroinitializer, align 4
-@w = internal global %"struct.<anonymous namespace>::walrus" zeroinitializer, align 1
-@wom = global %struct.wombat zeroinitializer, align 4
+@b = global %struct.bar zeroinitializer, align 1, !dbg !39
+@_ZN7echidna8capybara8mongoose6animalE = global %"class.echidna::capybara::mongoose::fluffy" zeroinitializer, align 4, !dbg !40
+@w = internal global %"struct.<anonymous namespace>::walrus" zeroinitializer, align 1, !dbg !41
+@wom = global %struct.wombat zeroinitializer, align 4, !dbg !42
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
 
 ; Function Attrs: nounwind uwtable
@@ -256,10 +256,10 @@ attributes #1 = { nounwind readnone }
 !36 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__I_a", line: 25, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial, isOptimized: false, unit: !0, scopeLine: 25, file: !1, scope: !23, type: !37, variables: !2)
 !37 = !DISubroutineType(types: !2)
 !38 = !{!39, !40, !41, !42}
-!39 = !DIGlobalVariable(name: "b", line: 3, isLocal: false, isDefinition: true, scope: null, file: !23, type: !4, variable: %struct.bar* @b)
-!40 = !DIGlobalVariable(name: "animal", linkageName: "_ZN7echidna8capybara8mongoose6animalE", line: 18, isLocal: false, isDefinition: true, scope: !7, file: !23, type: !6, variable: %"class.echidna::capybara::mongoose::fluffy"* @_ZN7echidna8capybara8mongoose6animalE)
-!41 = !DIGlobalVariable(name: "w", line: 29, isLocal: true, isDefinition: true, scope: null, file: !23, type: !28, variable: %"struct.<anonymous namespace>::walrus"* @w)
-!42 = !DIGlobalVariable(name: "wom", line: 38, isLocal: false, isDefinition: true, scope: null, file: !23, type: !14, variable: %struct.wombat* @wom)
+!39 = !DIGlobalVariable(name: "b", line: 3, isLocal: false, isDefinition: true, scope: null, file: !23, type: !4)
+!40 = !DIGlobalVariable(name: "animal", linkageName: "_ZN7echidna8capybara8mongoose6animalE", line: 18, isLocal: false, isDefinition: true, scope: !7, file: !23, type: !6)
+!41 = !DIGlobalVariable(name: "w", line: 29, isLocal: true, isDefinition: true, scope: null, file: !23, type: !28)
+!42 = !DIGlobalVariable(name: "wom", line: 38, isLocal: false, isDefinition: true, scope: null, file: !23, type: !14)
 !43 = !{i32 2, !"Dwarf Version", i32 4}
 !44 = !{i32 1, !"Debug Info Version", i32 3}
 !45 = !{!"clang version 3.5 "}
index 026e086..dade8bb 100644 (file)
 %struct.C = type { i8 }
 %"struct.ns::D" = type { i32 }
 
-@_ZN1C22static_member_variableE = global i32 0, align 4
-@global_variable = global %struct.C zeroinitializer, align 1
-@_ZN2ns25global_namespace_variableE = global i32 1, align 4
-@_ZN2ns1dE = global %"struct.ns::D" zeroinitializer, align 4
-@_ZZ2f3vE1z = internal global i32 0, align 4
-@_ZN12_GLOBAL__N_11iE = internal global i32 0, align 4
-@_ZN12_GLOBAL__N_15inner1bE = internal global i32 0, align 4
-@_ZN5outer12_GLOBAL__N_11cE = internal global i32 0, align 4
+@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !32
+@global_variable = global %struct.C zeroinitializer, align 1, !dbg !33
+@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !34
+@_ZN2ns1dE = global %"struct.ns::D" zeroinitializer, align 4, !dbg !35
+@_ZZ2f3vE1z = internal global i32 0, align 4, !dbg !36
+@_ZN12_GLOBAL__N_11iE = internal global i32 0, align 4, !dbg !37
+@_ZN12_GLOBAL__N_15inner1bE = internal global i32 0, align 4, !dbg !39
+@_ZN5outer12_GLOBAL__N_11cE = internal global i32 0, align 4, !dbg !41
 
 ; Function Attrs: nounwind uwtable
 define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 !dbg !20 {
@@ -331,16 +331,16 @@ attributes #1 = { nounwind readnone }
 !29 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64)
 !30 = distinct !DISubprogram(name: "f7", linkageName: "_Z2f7v", scope: !1, file: !1, line: 57, type: !13, isLocal: false, isDefinition: true, scopeLine: 57, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
 !31 = !{!32, !33, !34, !35, !36, !37, !39, !41}
-!32 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !0, file: !1, line: 7, type: !7, isLocal: false, isDefinition: true, variable: i32* @_ZN1C22static_member_variableE, declaration: !6)
-!33 = !DIGlobalVariable(name: "global_variable", scope: !0, file: !1, line: 17, type: !4, isLocal: false, isDefinition: true, variable: %struct.C* @global_variable)
-!34 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !16, file: !1, line: 27, type: !7, isLocal: false, isDefinition: true, variable: i32* @_ZN2ns25global_namespace_variableE)
-!35 = !DIGlobalVariable(name: "d", linkageName: "_ZN2ns1dE", scope: !16, file: !1, line: 31, type: !15, isLocal: false, isDefinition: true, variable: %"struct.ns::D"* @_ZN2ns1dE)
-!36 = !DIGlobalVariable(name: "z", scope: !26, file: !1, line: 41, type: !7, isLocal: true, isDefinition: true, variable: i32* @_ZZ2f3vE1z)
-!37 = !DIGlobalVariable(name: "i", linkageName: "_ZN12_GLOBAL__N_11iE", scope: !38, file: !1, line: 37, type: !7, isLocal: true, isDefinition: true, variable: i32* @_ZN12_GLOBAL__N_11iE)
+!32 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !0, file: !1, line: 7, type: !7, isLocal: false, isDefinition: true, declaration: !6)
+!33 = !DIGlobalVariable(name: "global_variable", scope: !0, file: !1, line: 17, type: !4, isLocal: false, isDefinition: true)
+!34 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !16, file: !1, line: 27, type: !7, isLocal: false, isDefinition: true)
+!35 = !DIGlobalVariable(name: "d", linkageName: "_ZN2ns1dE", scope: !16, file: !1, line: 31, type: !15, isLocal: false, isDefinition: true)
+!36 = !DIGlobalVariable(name: "z", scope: !26, file: !1, line: 41, type: !7, isLocal: true, isDefinition: true)
+!37 = !DIGlobalVariable(name: "i", linkageName: "_ZN12_GLOBAL__N_11iE", scope: !38, file: !1, line: 37, type: !7, isLocal: true, isDefinition: true)
 !38 = !DINamespace(scope: null, file: !1, line: 36)
-!39 = !DIGlobalVariable(name: "b", linkageName: "_ZN12_GLOBAL__N_15inner1bE", scope: !40, file: !1, line: 47, type: !7, isLocal: true, isDefinition: true, variable: i32* @_ZN12_GLOBAL__N_15inner1bE)
+!39 = !DIGlobalVariable(name: "b", linkageName: "_ZN12_GLOBAL__N_15inner1bE", scope: !40, file: !1, line: 47, type: !7, isLocal: true, isDefinition: true)
 !40 = !DINamespace(name: "inner", scope: !38, file: !1, line: 46)
-!41 = !DIGlobalVariable(name: "c", linkageName: "_ZN5outer12_GLOBAL__N_11cE", scope: !42, file: !1, line: 53, type: !7, isLocal: true, isDefinition: true, variable: i32* @_ZN5outer12_GLOBAL__N_11cE)
+!41 = !DIGlobalVariable(name: "c", linkageName: "_ZN5outer12_GLOBAL__N_11cE", scope: !42, file: !1, line: 53, type: !7, isLocal: true, isDefinition: true)
 !42 = !DINamespace(scope: !43, file: !1, line: 52)
 !43 = !DINamespace(name: "outer", scope: null, file: !1, line: 51)
 !44 = !{!45, !47}
index bdf0667..f4c18bb 100644 (file)
@@ -34,7 +34,7 @@
 
 %struct.foo = type { i8 }
 
-@i = global i32 0, align 4
+@i = global i32 0, align 4, !dbg !19
 
 ; Function Attrs: uwtable
 define i32 @main() #0 !dbg !13 {
@@ -82,7 +82,7 @@ attributes #1 = { nounwind readnone }
 !16 = !{!9}
 !17 = distinct !DISubprogram(name: "func", linkageName: "_ZN3foo4funcEi", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !4, type: !7, declaration: !6, variables: !2)
 !18 = !{!19}
-!19 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: null, file: !14, type: !9, variable: i32* @i)
+!19 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: null, file: !14, type: !9)
 !20 = !{i32 2, !"Dwarf Version", i32 4}
 !21 = !{i32 1, !"Debug Info Version", i32 3}
 !22 = !{!"clang version 3.5.0 "}
index ea5d88a..c19bd15 100644 (file)
@@ -19,8 +19,8 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@x = common global i32 0, align 4
-@y = common global i32 0, align 4
+@x = common global i32 0, align 4, !dbg !10
+@y = common global i32 0, align 4, !dbg !12
 
 define i32 @main() !dbg !4 {
 ; CHECK: .loc 1 {{[89]}}
@@ -58,9 +58,9 @@ select.end:                                       ; preds = %entry, %select.mid
 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !8 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 3, type: !5, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !2)
 !9 = !{!10, !12}
-!10 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true, variable: i32* @x)
+!10 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true)
 !11 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
-!12 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @y)
+!12 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
 !13 = !{i32 2, !"Dwarf Version", i32 4}
 !14 = !{i32 2, !"Debug Info Version", i32 3}
 !16 = !DILocation(line: 4, column: 9, scope: !17, inlinedAt: !18)
index dfb058b..7140a4d 100644 (file)
@@ -31,8 +31,8 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@glb_start = global i64 17, align 8
-@glb_end = global i64 42, align 8
+@glb_start = global i64 17, align 8, !dbg !7
+@glb_end = global i64 42, align 8, !dbg !10
 
 ; Function Attrs: norecurse nounwind uwtable
 define i32 @main() !dbg !14 {
@@ -73,10 +73,10 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
 !4 = !DIDerivedType(tag: DW_TAG_typedef, name: "fp_t", file: !1, line: 1, baseType: !5)
 !5 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)
 !6 = !{!7, !10}
-!7 = distinct !DIGlobalVariable(name: "glb_start", scope: !0, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, variable: i64* @glb_start)
+!7 = distinct !DIGlobalVariable(name: "glb_start", scope: !0, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true)
 !8 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_t", file: !1, line: 2, baseType: !9)
 !9 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
-!10 = distinct !DIGlobalVariable(name: "glb_end", scope: !0, file: !1, line: 5, type: !8, isLocal: false, isDefinition: true, variable: i64* @glb_end)
+!10 = distinct !DIGlobalVariable(name: "glb_end", scope: !0, file: !1, line: 5, type: !8, isLocal: false, isDefinition: true)
 !11 = !{i32 2, !"Dwarf Version", i32 4}
 !12 = !{i32 2, !"Debug Info Version", i32 3}
 !13 = !{!"clang version 3.9.0 (trunk 268246)"}
index 295b898..a84cde7 100644 (file)
@@ -7,7 +7,7 @@
 
 %class.A = type { i8 }
 
-@a = global %class.A zeroinitializer, align 1
+@a = global %class.A zeroinitializer, align 1, !dbg !20
 
 define i32 @_ZN1A1aEi(%class.A* %this, i32 %b) nounwind uwtable ssp align 2 !dbg !5 {
 entry:
@@ -39,7 +39,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 !12 = !{!13}
 !13 = !DISubprogram(name: "a", linkageName: "_ZN1A1aEi", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrivate | DIFlagPrototyped, isOptimized: false, file: !6, scope: !11, type: !7)
 !18 = !{!20}
-!20 = !DIGlobalVariable(name: "a", line: 9, isLocal: false, isDefinition: true, scope: null, file: !6, type: !11, variable: %class.A* @a)
+!20 = !DIGlobalVariable(name: "a", line: 9, isLocal: false, isDefinition: true, scope: null, file: !6, type: !11)
 !21 = !DILocalVariable(name: "this", line: 5, arg: 1, flags: DIFlagArtificial, scope: !5, file: !6, type: !22)
 !22 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !11)
 !23 = !DILocation(line: 5, column: 8, scope: !5)
index eca3010..d7a8298 100644 (file)
@@ -39,7 +39,7 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@m = common global i32 0, align 4
+@m = common global i32 0, align 4, !dbg !16
 @.str = private unnamed_addr constant [13 x i8] c"m(main): %d\0A\00", align 1
 
 ; Function Attrs: nounwind uwtable
@@ -119,7 +119,7 @@ attributes #4 = { nounwind }
 !13 = !DILocalVariable(name: "argv", arg: 2, scope: !4, file: !1, line: 6, type: !8)
 !14 = !DILocalVariable(name: "n", scope: !4, file: !1, line: 7, type: !7)
 !15 = !{!16}
-!16 = !DIGlobalVariable(name: "m", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @m)
+!16 = !DIGlobalVariable(name: "m", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
 !17 = !{i32 2, !"Dwarf Version", i32 4}
 !18 = !{i32 2, !"Debug Info Version", i32 3}
 !19 = !{!"clang version 3.8.0 (trunk 253049) "}
index bb6dca9..6d54824 100644 (file)
@@ -16,7 +16,7 @@ target triple = "x86_64-apple-macosx"
 
 %struct.A = type { i8 }
 
-@p = global { i64, i64 } { i64 ptrtoint (void (%struct.A*)* @_ZN1A3fooEv to i64), i64 0 }, align 8
+@p = global { i64, i64 } { i64 ptrtoint (void (%struct.A*)* @_ZN1A3fooEv to i64), i64 0 }, align 8, !dbg !11
 
 declare void @_ZN1A3fooEv(%struct.A*)
 
@@ -35,7 +35,7 @@ declare void @_ZN1A3fooEv(%struct.A*)
 !8 = !{null, !9}
 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
 !10 = !{!11}
-!11 = !DIGlobalVariable(name: "p", line: 5, isLocal: false, isDefinition: true, scope: null, file: !12, type: !13, variable: { i64, i64 }* @p)
+!11 = !DIGlobalVariable(name: "p", line: 5, isLocal: false, isDefinition: true, scope: null, file: !12, type: !13)
 !12 = !DIFile(filename: "memberfnptr.cpp", directory: "")
 !13 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, size: 64, baseType: !7, extraData: !4)
 !14 = !{i32 2, !"Dwarf Version", i32 2}
index 96d5980..5b923ff 100644 (file)
 
 %struct.Record = type { %struct.Record*, i32, i32, i32, [31 x i8] }
 
-@Version = global [4 x i8] c"1.1\00", align 1
-@IntGlob = common global i32 0, align 4
-@BoolGlob = common global i32 0, align 4
-@Char1Glob = common global i8 0, align 1
-@Char2Glob = common global i8 0, align 1
-@Array1Glob = common global [51 x i32] zeroinitializer, align 16
-@Array2Glob = common global [51 x [51 x i32]] zeroinitializer, align 16
-@PtrGlb = common global %struct.Record* null, align 8
-@PtrGlbNext = common global %struct.Record* null, align 8
+@Version = global [4 x i8] c"1.1\00", align 1, !dbg !30
+@IntGlob = common global i32 0, align 4, !dbg !35
+@BoolGlob = common global i32 0, align 4, !dbg !36
+@Char1Glob = common global i8 0, align 1, !dbg !38
+@Char2Glob = common global i8 0, align 1, !dbg !39
+@Array1Glob = common global [51 x i32] zeroinitializer, align 16, !dbg !40
+@Array2Glob = common global [51 x [51 x i32]] zeroinitializer, align 16, !dbg !42
+@PtrGlb = common global %struct.Record* null, align 8, !dbg !46
+@PtrGlbNext = common global %struct.Record* null, align 8, !dbg !63
 
 define void @Proc8(i32* nocapture %Array1Par, [51 x i32]* nocapture %Array2Par, i32 %IntParI1, i32 %IntParI2) nounwind optsize !dbg !12 {
 entry:
@@ -132,23 +132,23 @@ attributes #1 = { nounwind readnone }
 !27 = !DILocalVariable(name: "IntLoc", line: 186, scope: !12, file: !3, type: !21)
 !28 = !DILocalVariable(name: "IntIndex", line: 187, scope: !12, file: !3, type: !21)
 !29 = !{!30, !35, !36, !38, !39, !40, !42, !46, !63}
-!30 = !DIGlobalVariable(name: "Version", line: 111, isLocal: false, isDefinition: true, scope: null, file: !3, type: !31, variable: [4 x i8]* @Version)
+!30 = !DIGlobalVariable(name: "Version", line: 111, isLocal: false, isDefinition: true, scope: null, file: !3, type: !31)
 !31 = !DICompositeType(tag: DW_TAG_array_type, size: 32, align: 8, baseType: !32, elements: !33)
 !32 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
 !33 = !{!34}
 !34 = !DISubrange(count: 4)
-!35 = !DIGlobalVariable(name: "IntGlob", line: 171, isLocal: false, isDefinition: true, scope: null, file: !3, type: !16, variable: i32* @IntGlob)
-!36 = !DIGlobalVariable(name: "BoolGlob", line: 172, isLocal: false, isDefinition: true, scope: null, file: !3, type: !37, variable: i32* @BoolGlob)
+!35 = !DIGlobalVariable(name: "IntGlob", line: 171, isLocal: false, isDefinition: true, scope: null, file: !3, type: !16)
+!36 = !DIGlobalVariable(name: "BoolGlob", line: 172, isLocal: false, isDefinition: true, scope: null, file: !3, type: !37)
 !37 = !DIDerivedType(tag: DW_TAG_typedef, name: "boolean", line: 149, file: !82, baseType: !16)
-!38 = !DIGlobalVariable(name: "Char1Glob", line: 173, isLocal: false, isDefinition: true, scope: null, file: !3, type: !32, variable: i8* @Char1Glob)
-!39 = !DIGlobalVariable(name: "Char2Glob", line: 174, isLocal: false, isDefinition: true, scope: null, file: !3, type: !32, variable: i8* @Char2Glob)
-!40 = !DIGlobalVariable(name: "Array1Glob", line: 175, isLocal: false, isDefinition: true, scope: null, file: !3, type: !41, variable: [51 x i32]* @Array1Glob)
+!38 = !DIGlobalVariable(name: "Char1Glob", line: 173, isLocal: false, isDefinition: true, scope: null, file: !3, type: !32)
+!39 = !DIGlobalVariable(name: "Char2Glob", line: 174, isLocal: false, isDefinition: true, scope: null, file: !3, type: !32)
+!40 = !DIGlobalVariable(name: "Array1Glob", line: 175, isLocal: false, isDefinition: true, scope: null, file: !3, type: !41)
 !41 = !DIDerivedType(tag: DW_TAG_typedef, name: "Array1Dim", line: 135, file: !82, baseType: !18)
-!42 = !DIGlobalVariable(name: "Array2Glob", line: 176, isLocal: false, isDefinition: true, scope: null, file: !3, type: !43, variable: [51 x [51 x i32]]* @Array2Glob)
+!42 = !DIGlobalVariable(name: "Array2Glob", line: 176, isLocal: false, isDefinition: true, scope: null, file: !3, type: !43)
 !43 = !DIDerivedType(tag: DW_TAG_typedef, name: "Array2Dim", line: 136, file: !82, baseType: !44)
 !44 = !DICompositeType(tag: DW_TAG_array_type, size: 83232, align: 32, baseType: !16, elements: !45)
 !45 = !{!20, !20}
-!46 = !DIGlobalVariable(name: "PtrGlb", line: 177, isLocal: false, isDefinition: true, scope: null, file: !3, type: !47, variable: %struct.Record** @PtrGlb)
+!46 = !DIGlobalVariable(name: "PtrGlb", line: 177, isLocal: false, isDefinition: true, scope: null, file: !3, type: !47)
 !47 = !DIDerivedType(tag: DW_TAG_typedef, name: "RecordPtr", line: 148, file: !82, baseType: !48)
 !48 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !49)
 !49 = !DIDerivedType(tag: DW_TAG_typedef, name: "RecordType", line: 147, file: !82, baseType: !50)
@@ -165,7 +165,7 @@ attributes #1 = { nounwind readnone }
 !60 = !DICompositeType(tag: DW_TAG_array_type, size: 248, align: 8, baseType: !32, elements: !61)
 !61 = !{!62}
 !62 = !DISubrange(count: 31)
-!63 = !DIGlobalVariable(name: "PtrGlbNext", line: 178, isLocal: false, isDefinition: true, scope: null, file: !3, type: !47, variable: %struct.Record** @PtrGlbNext)
+!63 = !DIGlobalVariable(name: "PtrGlbNext", line: 178, isLocal: false, isDefinition: true, scope: null, file: !3, type: !47)
 !64 = !DILocation(line: 181, scope: !12)
 !65 = !DILocation(line: 182, scope: !12)
 !66 = !DILocation(line: 183, scope: !12)
index b07d718..77e1eee 100644 (file)
@@ -38,8 +38,8 @@
 ; ModuleID = 'test.bc'
 target triple = "x86_64-unknown-linux-gnu"
 
-@kittens = global i32 4, align 4
-@rainbows = global i32 5, align 4
+@kittens = global i32 4, align 4, !dbg !4
+@rainbows = global i32 5, align 4, !dbg !10
 
 !llvm.dbg.cu = !{!0, !7}
 !llvm.module.flags = !{!12, !13}
@@ -48,13 +48,13 @@ target triple = "x86_64-unknown-linux-gnu"
 !1 = !DIFile(filename: "test1.c", directory: "/home/kayamon")
 !2 = !{}
 !3 = !{!4}
-!4 = !DIGlobalVariable(name: "kittens", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6, variable: i32* @kittens)
+!4 = !DIGlobalVariable(name: "kittens", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !6)
 !5 = !DIFile(filename: "test1.c", directory: "/home/kayamon")
 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !8, enums: !2, retainedTypes: !2, globals: !9, imports: !2)
 !8 = !DIFile(filename: "test2.c", directory: "/home/kayamon")
 !9 = !{!10}
-!10 = !DIGlobalVariable(name: "rainbows", line: 1, isLocal: false, isDefinition: true, scope: null, file: !11, type: !6, variable: i32* @rainbows)
+!10 = !DIGlobalVariable(name: "rainbows", line: 1, isLocal: false, isDefinition: true, scope: null, file: !11, type: !6)
 !11 = !DIFile(filename: "test2.c", directory: "/home/kayamon")
 !12 = !{i32 2, !"Dwarf Version", i32 4}
 !13 = !{i32 1, !"Debug Info Version", i32 3}
index 052d905..fcfd48f 100644 (file)
@@ -56,7 +56,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
 !960 = distinct !DISubprogram(name: "main", line: 73, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 73, file: !1802, scope: null, type: !54, variables: !955)
 !961 = !DIFile(filename: "student2.cpp", directory: "/privite/tmp")
 !1786 = !{!1800}
-!1800 = !DIGlobalVariable(name: "badbit", linkageName: "badbit", line: 331, isLocal: true, isDefinition: true, scope: !5, file: !5, type: !78, variable: i32 1, declaration: !77)
+!1800 = !DIGlobalVariable(name: "badbit", linkageName: "badbit", line: 331, isLocal: true, isDefinition: true, scope: !5, file: !5, type: !78, expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value), declaration: !77)
 !1801 = !DIFile(filename: "os_base.h", directory: "/privite/tmp")
 !1802 = !DIFile(filename: "student2.cpp", directory: "/privite/tmp")
 !1803 = !{i32 1, !"Debug Info Version", i32 3}
index ee5f2d9..9f1b250 100644 (file)
@@ -3,7 +3,7 @@
 
 %class.A = type { [42 x i32] }
 
-@a = global %class.A zeroinitializer, align 4
+@a = global %class.A zeroinitializer, align 4, !dbg !5
 
 ; Check that we can handle non-default array bounds. In this case, the array
 ; goes from [-3, 38].
@@ -33,7 +33,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 169136)", isOptimized: false, emissionKind: FullDebug, file: !20, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %class.A* @a)
+!5 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "t.cpp", directory: "/Volumes/Sandbox/llvm")
 !7 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 1, align: 32, file: !20, elements: !8)
 !8 = !{!9, !14}
index af12e16..9a6895a 100644 (file)
@@ -7,7 +7,7 @@
 
 %0 = type opaque
 
-@a = common global %0* null, align 8
+@a = common global %0* null, align 8, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!9, !10, !11, !12, !14}
@@ -15,7 +15,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_ObjC, producer: "clang version 3.1 (trunk 152054 trunk 152094)", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, file: !13, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 3, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %0** @a)
+!5 = !DIGlobalVariable(name: "a", line: 3, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "foo.m", directory: "/Users/echristo")
 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
 !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "FooBarBaz", line: 1, flags: DIFlagFwdDecl, runtimeLang: DW_LANG_ObjC, file: !13)
index e26ea2e..6de3596 100644 (file)
@@ -6,7 +6,7 @@
 
 %struct.crass = type { i8* }
 
-@crass = common global %struct.crass zeroinitializer, align 8
+@crass = common global %struct.crass zeroinitializer, align 8, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!14}
@@ -14,7 +14,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 147882)", isOptimized: false, emissionKind: FullDebug, file: !13, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "crass", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %struct.crass* @crass)
+!5 = !DIGlobalVariable(name: "crass", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "foo.c", directory: "/Users/echristo/tmp")
 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "crass", line: 1, size: 64, align: 64, file: !13, elements: !8)
 !8 = !{!9}
index 99decb6..2b0400d 100644 (file)
@@ -174,7 +174,7 @@ entry:
 !126 = distinct !DISubprogram(name: "function<BPLFunctionWriter::<lambda at BPLFunctionWriter2.ii:20:36> >", linkageName: "_ZN8functionIFvvEEC2IZN17BPLFunctionWriter9writeExprEvE3$_0EET_", line: 8, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 8, file: !6, scope: null, type: !23, templateParams: !47, declaration: !22, variables: !1)
 !127 = distinct !DISubprogram(name: "_M_not_empty_function<BPLFunctionWriter::<lambda at BPLFunctionWriter2.ii:20:36> >", linkageName: "_ZN13_Base_manager21_M_not_empty_functionIZN17BPLFunctionWriter9writeExprEvE3$_0EEvRKT_", line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !6, scope: null, type: !117, templateParams: !120, declaration: !116, variables: !1)
 !128 = !{!130}
-!130 = !DIGlobalVariable(name: "__stored_locally", linkageName: "__stored_locally", line: 2, isLocal: true, isDefinition: true, scope: !114, file: !6, type: !131, variable: i1 1)
+!130 = !DIGlobalVariable(name: "__stored_locally", linkageName: "__stored_locally", line: 2, isLocal: true, isDefinition: true, scope: !114, file: !6, type: !131, expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value))
 !131 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !132)
 !132 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
 !133 = !DILocalVariable(name: "this", line: 19, arg: 1, flags: DIFlagArtificial, scope: !5, file: !6, type: !134)
index c6bf3ce..167a154 100644 (file)
@@ -52,8 +52,8 @@
 
 %struct.foo = type { i8 }
 
-@f = global %struct.foo zeroinitializer, align 1
-@g = global %struct.foo zeroinitializer, align 1
+@f = global %struct.foo zeroinitializer, align 1, !dbg !7
+@g = global %struct.foo zeroinitializer, align 1, !dbg !12
 
 !llvm.dbg.cu = !{!0, !9}
 !llvm.module.flags = !{!14, !15}
 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !5, elements: !2, identifier: "_ZTS3foo")
 !5 = !DIFile(filename: "./hdr.h", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr")
 !6 = !{!7}
-!7 = !DIGlobalVariable(name: "f", line: 2, isLocal: false, isDefinition: true, scope: null, file: !8, type: !4, variable: %struct.foo* @f)
+!7 = !DIGlobalVariable(name: "f", line: 2, isLocal: false, isDefinition: true, scope: null, file: !8, type: !4)
 !8 = !DIFile(filename: "tu1.cpp", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr")
 !9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (trunk 191799)", isOptimized: false, emissionKind: FullDebug, file: !10, enums: !2, retainedTypes: !3, globals: !11, imports: !2)
 !10 = !DIFile(filename: "tu2.cpp", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr")
 !11 = !{!12}
-!12 = !DIGlobalVariable(name: "g", line: 2, isLocal: false, isDefinition: true, scope: null, file: !13, type: !4, variable: %struct.foo* @g)
+!12 = !DIGlobalVariable(name: "g", line: 2, isLocal: false, isDefinition: true, scope: null, file: !13, type: !4)
 !13 = !DIFile(filename: "tu2.cpp", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr")
 !14 = !{i32 2, !"Dwarf Version", i32 2}
 !15 = !{i32 1, !"Debug Info Version", i32 3}
diff --git a/llvm/test/DebugInfo/X86/stack-value-dwarf4.ll b/llvm/test/DebugInfo/X86/stack-value-dwarf4.ll
new file mode 100644 (file)
index 0000000..ad2aeb2
--- /dev/null
@@ -0,0 +1,37 @@
+; RUN: llc -o - %s | FileCheck --check-prefix=CHECK-DWARF2 %s
+; RUN: llc -dwarf-version=4 -o - %s | FileCheck --check-prefix=CHECK-DWARF4 %s
+
+target datalayout = "e-p:64:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK-DWARF2:      .byte     13                      # DW_AT_location
+; CHECK-DWARF2-NEXT: .byte     3
+; CHECK-DWARF2-NEXT: .quad     g
+; CHECK-DWARF2-NEXT: .byte     16
+; CHECK-DWARF2-NEXT: .byte     4
+; CHECK-DWARF2-NEXT: .byte     16
+; CHECK-DWARF2-NEXT: .byte     4
+
+; CHECK-DWARF4:      .byte     14                      # DW_AT_location
+; CHECK-DWARF4-NEXT: .byte     3
+; CHECK-DWARF4-NEXT: .quad     g
+; CHECK-DWARF4-NEXT: .byte     16
+; CHECK-DWARF4-NEXT: .byte     4
+; CHECK-DWARF4-NEXT: .byte     16
+; CHECK-DWARF4-NEXT: .byte     4
+; CHECK-DWARF4-NEXT: .byte     159
+
+@g = global i32 0, !dbg !2
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", file: !4, globals: !1, emissionKind: FullDebug)
+!1 = !{!2}
+!2 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false, isDefinition: true, expr: !3, type: !5)
+!3 = !DIExpression(DW_OP_constu, 4, DW_OP_constu, 4, DW_OP_stack_value)
+!4 = !DIFile(filename: "<stdin>", directory: "/")
+!5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+
+!6 = !{i32 2, !"Dwarf Version", i32 2}
+!7 = !{i32 2, !"Debug Info Version", i32 3}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!6, !7}
index 970871c..87d1c61 100644 (file)
@@ -1,7 +1,7 @@
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=LINUX
 ; RUN: llc -mtriple=x86_64-darwin < %s | FileCheck %s --check-prefix=DARWIN
 
-@yyyy = common global i32 0, align 4
+@yyyy = common global i32 0, align 4, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!9}
@@ -9,7 +9,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 143009)", isOptimized: true, emissionKind: FullDebug, file: !8, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "yyyy", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i32* @yyyy)
+!5 = !DIGlobalVariable(name: "yyyy", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "z.c", directory: "/home/nicholas")
 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !8 = !DIFile(filename: "z.c", directory: "/home/nicholas")
index b5da533..b3acab0 100644 (file)
@@ -9,7 +9,7 @@
 
 %struct.foo = type { i32 }
 
-@f = common global %struct.foo zeroinitializer, align 4
+@f = common global %struct.foo zeroinitializer, align 4, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!12}
@@ -17,7 +17,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 152837) (llvm/trunk 152845)", isOptimized: false, emissionKind: FullDebug, file: !11, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "f", line: 5, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %struct.foo* @f)
+!5 = !DIGlobalVariable(name: "f", line: 5, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "struct_bug.c", directory: "/Users/echristo/tmp")
 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 32, align: 32, file: !11, elements: !8)
 !8 = !{!9}
index 337f238..d17874d 100644 (file)
@@ -60,8 +60,8 @@
 
 %"struct.y_impl<int>::nested" = type { i8 }
 
-@glbl = global i32 0, align 4
-@n = global %"struct.y_impl<int>::nested" zeroinitializer, align 1
+@glbl = global i32 0, align 4, !dbg !31
+@n = global %"struct.y_impl<int>::nested" zeroinitializer, align 1, !dbg !32
 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_template.cpp, i8* null }]
 
 define internal void @__cxx_global_var_init() section ".text.startup" !dbg !10 {
@@ -119,8 +119,8 @@ attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe
 !28 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__sub_I_template.cpp", isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, file: !1, scope: !11, type: !29, variables: !2)
 !29 = !DISubroutineType(types: !2)
 !30 = !{!31, !32}
-!31 = !DIGlobalVariable(name: "glbl", line: 3, isLocal: false, isDefinition: true, scope: null, file: !11, type: !7, variable: i32* @glbl)
-!32 = !DIGlobalVariable(name: "n", line: 4, isLocal: false, isDefinition: true, scope: null, file: !11, type: !8, variable: %"struct.y_impl<int>::nested"* @n)
+!31 = !DIGlobalVariable(name: "glbl", line: 3, isLocal: false, isDefinition: true, scope: null, file: !11, type: !7)
+!32 = !DIGlobalVariable(name: "n", line: 4, isLocal: false, isDefinition: true, scope: null, file: !11, type: !8)
 !33 = !{i32 2, !"Dwarf Version", i32 4}
 !34 = !{i32 2, !"Debug Info Version", i32 3}
 !35 = !{!"clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)"}
index 5533c45..40c356b 100644 (file)
@@ -96,8 +96,8 @@
 ; template int func<&glbl>(); // create a second reference to 'glbl'
 
 
-@tls = thread_local global i32 0, align 4
-@glbl = global i32 0, align 4
+@tls = thread_local global i32 0, align 4, !dbg !13
+@glbl = global i32 0, align 4, !dbg !14
 
 ; Function Attrs: nounwind uwtable
 define weak_odr i32 @_Z4funcIXadL_Z4glblEEEiv() #0 !dbg !4 {
@@ -123,8 +123,8 @@ attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe
 !10 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "I", type: !11, value: i32* @glbl)
 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
 !12 = !{!13, !14}
-!13 = !DIGlobalVariable(name: "tls", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @tls)
-!14 = !DIGlobalVariable(name: "glbl", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @glbl)
+!13 = !DIGlobalVariable(name: "tls", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8)
+!14 = !DIGlobalVariable(name: "glbl", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8)
 !15 = !{i32 2, !"Dwarf Version", i32 4}
 !16 = !{i32 1, !"Debug Info Version", i32 3}
 !17 = !{!"clang version 3.5 "}
index f75e32a..e145626 100644 (file)
 %struct.S4_1 = type { i8 }
 %struct.S4_2 = type { i8 }
 
-@i = global i32 0, align 4
-@a = global %struct.S1 zeroinitializer, align 1
-@s2 = global %struct.S2 zeroinitializer, align 1
-@s3 = global %struct.S3 zeroinitializer, align 1
-@s4 = global %struct.S4 zeroinitializer, align 1
+@i = global i32 0, align 4, !dbg !28
+@a = global %struct.S1 zeroinitializer, align 1, !dbg !30
+@s2 = global %struct.S2 zeroinitializer, align 1, !dbg !31
+@s3 = global %struct.S3 zeroinitializer, align 1, !dbg !32
+@s4 = global %struct.S4 zeroinitializer, align 1, !dbg !33
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!34, !35}
 !25 = !{!26}
 !26 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "T", type: !7, value: i32* @i)
 !27 = !{!28, !30, !31, !32, !33}
-!28 = !DIGlobalVariable(name: "i", line: 1, isLocal: false, isDefinition: true, scope: null, file: !29, type: !8, variable: i32* @i)
+!28 = !DIGlobalVariable(name: "i", line: 1, isLocal: false, isDefinition: true, scope: null, file: !29, type: !8)
 !29 = !DIFile(filename: "tu.cpp", directory: "/tmp/dbginfo")
-!30 = !DIGlobalVariable(name: "a", line: 6, isLocal: false, isDefinition: true, scope: null, file: !29, type: !4, variable: %struct.S1* @a)
-!31 = !DIGlobalVariable(name: "s2", line: 15, isLocal: false, isDefinition: true, scope: null, file: !29, type: !9, variable: %struct.S2* @s2)
-!32 = !DIGlobalVariable(name: "s3", line: 27, isLocal: false, isDefinition: true, scope: null, file: !29, type: !13, variable: %struct.S3* @s3)
-!33 = !DIGlobalVariable(name: "s4", line: 39, isLocal: false, isDefinition: true, scope: null, file: !29, type: !19, variable: %struct.S4* @s4)
+!30 = !DIGlobalVariable(name: "a", line: 6, isLocal: false, isDefinition: true, scope: null, file: !29, type: !4)
+!31 = !DIGlobalVariable(name: "s2", line: 15, isLocal: false, isDefinition: true, scope: null, file: !29, type: !9)
+!32 = !DIGlobalVariable(name: "s3", line: 27, isLocal: false, isDefinition: true, scope: null, file: !29, type: !13)
+!33 = !DIGlobalVariable(name: "s4", line: 39, isLocal: false, isDefinition: true, scope: null, file: !29, type: !19)
 !34 = !{i32 2, !"Dwarf Version", i32 4}
 !35 = !{i32 1, !"Debug Info Version", i32 3}
 !36 = !{!"clang version 3.5.0 "}
diff --git a/llvm/test/DebugInfo/X86/unattached-global.ll b/llvm/test/DebugInfo/X86/unattached-global.ll
new file mode 100644 (file)
index 0000000..d271e4e
--- /dev/null
@@ -0,0 +1,19 @@
+; RUN: llc -o - %s | FileCheck %s
+
+target datalayout = "e-p:64:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK: .byte    0                       # DW_AT_location
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", file: !4, globals: !1, emissionKind: FullDebug)
+!1 = !{!2}
+!2 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false, isDefinition: true, expr: !3, type: !5)
+!3 = !DIExpression(DW_OP_plus, 4)
+!4 = !DIFile(filename: "<stdin>", directory: "/")
+!5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+
+!6 = !{i32 2, !"Dwarf Version", i32 2}
+!7 = !{i32 2, !"Debug Info Version", i32 3}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!6, !7}
index 58d44c7..437d616 100644 (file)
@@ -9,7 +9,7 @@
 
 %"union.PR15637::Value" = type { i32 }
 
-@_ZN7PR156371fE = global %"union.PR15637::Value" zeroinitializer, align 4
+@_ZN7PR156371fE = global %"union.PR15637::Value" zeroinitializer, align 4, !dbg !10
 
 define void @_ZN7PR156371gEf(float %value) #0 !dbg !4 {
 entry:
@@ -38,7 +38,7 @@ attributes #1 = { nounwind readnone }
 !7 = !{null, !8}
 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
 !9 = !{!10}
-!10 = !DIGlobalVariable(name: "f", linkageName: "_ZN7PR156371fE", line: 6, isLocal: false, isDefinition: true, scope: !5, file: !11, type: !12, variable: %"union.PR15637::Value"* @_ZN7PR156371fE)
+!10 = !DIGlobalVariable(name: "f", linkageName: "_ZN7PR156371fE", line: 6, isLocal: false, isDefinition: true, scope: !5, file: !11, type: !12)
 !11 = !DIFile(filename: "foo.cc", directory: "/usr/local/google/home/echristo/tmp")
 !12 = !DICompositeType(tag: DW_TAG_union_type, name: "Value<float>", line: 2, size: 32, align: 32, file: !1, scope: !5, elements: !13, templateParams: !21)
 !13 = !{!14, !16}
index 7d6abd7..3bd5e6f 100644 (file)
@@ -7,7 +7,7 @@
 ;
 ; v4si a
 
-@a = common global <4 x i32> zeroinitializer, align 16
+@a = common global <4 x i32> zeroinitializer, align 16, !dbg !5
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!13}
@@ -15,7 +15,7 @@
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 171825) (llvm/trunk 171822)", isOptimized: false, emissionKind: FullDebug, file: !12, enums: !1, retainedTypes: !1, globals: !3, imports:  !1)
 !1 = !{}
 !3 = !{!5}
-!5 = !DIGlobalVariable(name: "a", line: 3, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: <4 x i32>* @a)
+!5 = !DIGlobalVariable(name: "a", line: 3, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7)
 !6 = !DIFile(filename: "foo.c", directory: "/Users/echristo")
 !7 = !DIDerivedType(tag: DW_TAG_typedef, name: "v4si", line: 1, file: !12, baseType: !8)
 !8 = !DICompositeType(tag: DW_TAG_array_type, size: 128, align: 128, flags: DIFlagVector, baseType: !9, elements: !10)
index dbc193a..bbcc3fc 100644 (file)
@@ -2,16 +2,17 @@
 ; RUN: llvm-dis < %t.bc | FileCheck %s
 ; Test if internal global variable's debug info is merged appropriately or not.
 
-; CHECK: !DIGlobalVariable(name: "x",
+; CHECK: @x = internal global i32 0, align 4, !dbg [[DI1:![0-9]+]]
+; CHECK: @x.1 = internal global i32 0, align 4, !dbg [[DI2:![0-9]+]]
+
+; CHECK: [[DI1]] = !DIGlobalVariable(name: "x",
 ; CHECK-NOT:               linkageName:
-; CHECK-SAME:              variable: i32* @x{{[,)]}}
-; CHECK: !DIGlobalVariable(name: "x",
+; CHECK: [[DI2]] = !DIGlobalVariable(name: "x",
 ; CHECK-NOT:               linkageName:
-; CHECK-SAME:              variable: i32* @x.1{{[,)]}}
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.7.0"
 
-@x = internal global i32 0, align 4
+@x = internal global i32 0, align 4, !dbg !5
 
 define void @foo() nounwind uwtable ssp !dbg !1 {
 entry:
@@ -27,7 +28,7 @@ entry:
 !2 = !DIFile(filename: "/tmp/one.c", directory: "/Volumes/Lalgate/Slate/D")
 !3 = !DISubroutineType(types: !4)
 !4 = !{null}
-!5 = !DIGlobalVariable(name: "x", line: 2, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !6, variable: i32* @x)
+!5 = !DIGlobalVariable(name: "x", line: 2, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !6)
 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !DILocation(line: 3, column: 14, scope: !8)
 !8 = distinct !DILexicalBlock(line: 3, column: 12, file: !9, scope: !1)
index 12b0d43..f15a841 100644 (file)
@@ -6,7 +6,7 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.7.0"
 
-@x = internal global i32 0, align 4
+@x = internal global i32 0, align 4, !dbg !5
 
 define void @bar() nounwind uwtable ssp !dbg !1 {
 entry:
@@ -22,7 +22,7 @@ entry:
 !2 = !DIFile(filename: "/tmp/two.c", directory: "/Volumes/Lalgate/Slate/D")
 !3 = !DISubroutineType(types: !4)
 !4 = !{null}
-!5 = !DIGlobalVariable(name: "x", line: 1, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !6, variable: i32* @x)
+!5 = !DIGlobalVariable(name: "x", line: 1, isLocal: true, isDefinition: true, scope: !0, file: !2, type: !6)
 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !7 = !DILocation(line: 2, column: 14, scope: !8)
 !8 = distinct !DILexicalBlock(line: 2, column: 12, file: !9, scope: !1)
index db54995..a3ca855 100644 (file)
@@ -3,7 +3,7 @@
 ; RUN: llvm-as %p/Inputs/odr.ll -o %t2.bc
 ; Check that we can link it
 ; RUN: llvm-link %t1.bc %t2.bc -o %t
-@bar = global i64 0, align 8
+@bar = global i64 0, align 8, !dbg !6
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7}
@@ -14,5 +14,5 @@
 !3 = distinct !DICompositeType(tag: DW_TAG_class_type, scope: !4, file: !1, identifier: "zed")
 !4 = distinct !DISubprogram(name: "b", scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
 !5 = !{!6}
-!6 = distinct !DIGlobalVariable(name: "c", scope: null, isLocal: false, isDefinition: true, variable: i64* @bar)
+!6 = distinct !DIGlobalVariable(name: "c", scope: null, isLocal: false, isDefinition: true)
 !7 = !{i32 2, !"Debug Info Version", i32 3}
index 2f8858e..2d1949f 100644 (file)
@@ -11,8 +11,8 @@
 ; ONLYNEEDED: distinct !DISubprogram(name: "foo"
 ; ONLYNEEDED-NOT: distinct !DISubprogram(name: "unused"
 
-@X = global i32 5
-@U = global i32 6
+@X = global i32 5, !dbg !14
+@U = global i32 6, !dbg !15
 @U_linkonce = linkonce_odr hidden global i32 6
 define i32 @foo() !dbg !4 {
     ret i32 7, !dbg !20
@@ -38,8 +38,8 @@ define i32 @unused() !dbg !10 {
 !11 = !DISubroutineType(types: !12)
 !12 = !{!7}
 !13 = !{!14, !15}
-!14 = !DIGlobalVariable(name: "X", scope: !0, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, variable: i32* @X)
-!15 = !DIGlobalVariable(name: "U", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @U)
+!14 = !DIGlobalVariable(name: "X", scope: !0, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true)
+!15 = !DIGlobalVariable(name: "U", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
 !16 = !{i32 2, !"Dwarf Version", i32 4}
 !17 = !{i32 2, !"Debug Info Version", i32 3}
 !18 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"}
index 9bb9a2f..2f70787 100644 (file)
@@ -17,7 +17,7 @@ define void @bar(i32 %arg) {
 !1 = !DIFile(filename: "2.cpp", directory: "some_dir")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "a_global", linkageName: "a_global", scope: null, line: 52, type: !5, isLocal: true, isDefinition: true, variable: %another_type** undef)
+!4 = distinct !DIGlobalVariable(name: "a_global", linkageName: "a_global", scope: null, line: 52, type: !5, isLocal: true, isDefinition: true)
 !5 = !DISubroutineType(types: !2)
 !6 = !{i32 2, !"Debug Info Version", i32 3}
 !7 = distinct !DILocation(line: 728, column: 71, scope: !8, inlinedAt: !14)
index 82a728e..b44bb81 100644 (file)
@@ -5,7 +5,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.11.0"
 
 
-@argc = global i8 0, align 1
+@argc = global i8 0, align 1, !dbg !21
 
 define void @globalfunc() {
 entry:
@@ -40,7 +40,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
 !18 = !DILocalVariable(name: "c", line: 7, scope: !13, file: !14, type: !4)
 !19 = !DILocalVariable(name: "lc", line: 8, scope: !13, file: !14, type: !11)
 !20 = !{!21}
-!21 = !DIGlobalVariable(name: "argc", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !11, variable: i8* @argc)
+!21 = !DIGlobalVariable(name: "argc", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !11)
 !22 = !{i32 2, !"Dwarf Version", i32 4}
 !23 = !{i32 2, !"Debug Info Version", i32 0}
 !25 = !DILocation(line: 8, column: 3, scope: !13)
index b250afa..b906357 100644 (file)
@@ -29,7 +29,7 @@ declare void @bar(i32)
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "Apple LLVM version 8.0.0 (clang-800.0.24.1)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !2)
 !1 = !DIFile(filename: "1.cpp", directory: "/another_dir")
 !2 = !{!3}
-!3 = distinct !DIGlobalVariable(name: "_", linkageName: "some_global", scope: null, file: !1, line: 20, type: !4, isLocal: true, isDefinition: true, variable: %some_type* undef)
+!3 = distinct !DIGlobalVariable(name: "_", linkageName: "some_global", scope: null, file: !1, line: 20, type: !4, isLocal: true, isDefinition: true)
 !4 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "slice_nil", file: !1, line: 13, size: 64, align: 64, elements: !5, identifier: "_ZTSN5boost6python3api9slice_nilE")
 !5 = !{}
 !6 = !{i32 2, !"Debug Info Version", i32 3}
index 424e0b5..51dde57 100644 (file)
@@ -22,7 +22,7 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@A = common global i32 0, align 4
+@A = common global i32 0, align 4, !dbg !9
 
 ; Function Attrs: nounwind uwtable
 define void @test() #0 !dbg !4 {
@@ -61,7 +61,7 @@ attributes #2 = { nounwind }
 !6 = !DISubroutineType(types: !7)
 !7 = !{null}
 !8 = !{!9}
-!9 = !DIGlobalVariable(name: "A", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10, variable: i32* @A)
+!9 = !DIGlobalVariable(name: "A", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10)
 !10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !11 = !{i32 2, !"Dwarf Version", i32 4}
 !12 = !{i32 2, !"Debug Info Version", i32 3}
diff --git a/llvm/test/Transforms/GlobalMerge/debug-info.ll b/llvm/test/Transforms/GlobalMerge/debug-info.ll
new file mode 100644 (file)
index 0000000..ba0109a
--- /dev/null
@@ -0,0 +1,23 @@
+; RUN: opt -global-merge -global-merge-max-offset=100 -S -o - %s | FileCheck %s
+
+target datalayout = "e-p:64:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK: @_MergedGlobals = private global { i32, i32 } { i32 1, i32 2 }, !dbg [[A:![0-9]+]], !dbg [[B:![0-9]+]]
+
+@a = internal global i32 1, !dbg !0
+@b = internal global i32 2, !dbg !1
+
+define void @use1() {
+  %x = load i32, i32* @a
+  %y = load i32, i32* @b
+  ret void
+}
+
+; CHECK: [[A]] = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false, isDefinition: true)
+; CHECK: [[B]] = distinct !DIGlobalVariable(name: "b", scope: null, isLocal: false, isDefinition: true, expr: [[EXPR:![0-9]+]])
+; CHECK: [[EXPR]] = !DIExpression(DW_OP_plus, 4)
+
+
+!0 = distinct !DIGlobalVariable(name: "a")
+!1 = distinct !DIGlobalVariable(name: "b")
index 3f6e269..587ec9b 100644 (file)
@@ -2,7 +2,7 @@
 ; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | FileCheck %s
 ; CHECK: 1 globalopt - Number of global vars shrunk to booleans
 
-@Stop = internal global i32 0                     ; <i32*> [#uses=3]
+@Stop = internal global i32 0, !dbg !0                     ; <i32*> [#uses=3]
 
 define i32 @foo(i32 %i) nounwind ssp {
 entry:
@@ -55,7 +55,7 @@ return:                                           ; preds = %bb2
 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
 
 !llvm.dbg.cu = !{!1}
-!0 = !DIGlobalVariable(name: "Stop", line: 2, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !2, variable: i32* @Stop)
+!0 = !DIGlobalVariable(name: "Stop", line: 2, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !2)
 !1 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !20, enums: !21, retainedTypes: !21, globals: !{!0})
 !2 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !3 = !DILocalVariable(name: "i", line: 4, arg: 1, scope: !4, file: !1, type: !2)
index d06a929..44ca11a 100644 (file)
@@ -21,8 +21,8 @@ target triple = "aarch64-apple-darwin"
 
 %struct.A = type { i32, [2 x double] }
 
-@a = global %struct.A zeroinitializer, align 8
-@b = global %struct.A zeroinitializer, align 8
+@a = global %struct.A zeroinitializer, align 8, !dbg !26
+@b = global %struct.A zeroinitializer, align 8, !dbg !27
 
 ; Function Attrs: nounwind
 declare void @_Z3fn31A(%struct.A* nocapture readonly %p1) #0
@@ -107,8 +107,8 @@ attributes #3 = { noreturn nounwind }
 !23 = !{null}
 !24 = distinct !DISubprogram(name: "fn5", linkageName: "_Z3fn5v", line: 13, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 13, file: !5, scope: !16, type: !22, variables: !2)
 !25 = !{!26, !27}
-!26 = !DIGlobalVariable(name: "a", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !4, variable: %struct.A* @a)
-!27 = !DIGlobalVariable(name: "b", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !4, variable: %struct.A* @b)
+!26 = !DIGlobalVariable(name: "a", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !4)
+!27 = !DIGlobalVariable(name: "b", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !4)
 !28 = !{i32 2, !"Dwarf Version", i32 4}
 !29 = !{i32 2, !"Debug Info Version", i32 3}
 !30 = !{!"clang version 3.7.0 (trunk 227480) (llvm/trunk 227517)"}
index d7d3ff6..c25801f 100644 (file)
@@ -4,9 +4,9 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.8.0"
 
-@A = global [1024 x i32] zeroinitializer, align 16
-@B = global [1024 x i32] zeroinitializer, align 16
-@C = global [1024 x i32] zeroinitializer, align 16
+@A = global [1024 x i32] zeroinitializer, align 16, !dbg !12
+@B = global [1024 x i32] zeroinitializer, align 16, !dbg !16
+@C = global [1024 x i32] zeroinitializer, align 16, !dbg !17
 
 ; CHECK-LABEL: @test(
 define i32 @test() #0 !dbg !3 {
@@ -55,12 +55,12 @@ attributes #1 = { nounwind readnone }
 !9 = !DILocalVariable(name: "i", line: 6, scope: !10, file: !4, type: !7)
 !10 = distinct !DILexicalBlock(line: 6, column: 0, file: !25, scope: !3)
 !11 = !{!12, !16, !17}
-!12 = !DIGlobalVariable(name: "A", line: 1, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @A)
+!12 = !DIGlobalVariable(name: "A", line: 1, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13)
 !13 = !DICompositeType(tag: DW_TAG_array_type, size: 32768, align: 32, baseType: !7, elements: !14)
 !14 = !{!15}
 !15 = !{i32 786465, i64 0, i64 1024}
-!16 = !DIGlobalVariable(name: "B", line: 2, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @B)
-!17 = !DIGlobalVariable(name: "C", line: 3, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13, variable: [1024 x i32]* @C)
+!16 = !DIGlobalVariable(name: "B", line: 2, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13)
+!17 = !DIGlobalVariable(name: "C", line: 3, isLocal: false, isDefinition: true, scope: null, file: !4, type: !13)
 !18 = !DILocation(line: 6, scope: !10)
 !19 = !DILocation(line: 7, scope: !20)
 !20 = distinct !DILexicalBlock(line: 6, column: 0, file: !25, scope: !10)
index dc3e6de..9ffa8ca 100644 (file)
@@ -13,7 +13,7 @@
 ; Coverage for this profile should be 100%
 ; CHECK-NOT: warning: cov-zero-samples.cc:1:
 
-@N = global i64 8000000000, align 8
+@N = global i64 8000000000, align 8, !dbg !12
 @.str = private unnamed_addr constant [11 x i8] c"sum is %d\0A\00", align 1
 
 ; Function Attrs: nounwind uwtable
@@ -98,7 +98,7 @@ declare i32 @printf(i8*, ...)
 !9 = !DISubroutineType(types: !10)
 !10 = !{!7}
 !11 = !{!12}
-!12 = !DIGlobalVariable(name: "N", scope: !0, file: !1, line: 3, type: !13, isLocal: false, isDefinition: true, variable: i64* @N)
+!12 = !DIGlobalVariable(name: "N", scope: !0, file: !1, line: 3, type: !13, isLocal: false, isDefinition: true)
 !13 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !14)
 !14 = !DIBasicType(name: "long long int", size: 64, align: 64, encoding: DW_ATE_signed)
 !15 = !{i32 2, !"Dwarf Version", i32 4}
index 872444d..94e32de 100644 (file)
@@ -9,9 +9,9 @@
 ; ModuleID = './csmith107.i.debug.ll'
 source_filename = "./csmith107.i.debug.ll"
 
-@a = global i16 0
-@b = global i32 0
-@c = global i16* null
+@a = global i16 0, !dbg !4
+@b = global i32 0, !dbg !6
+@c = global i16* null, !dbg !10
 
 
 ; Function Attrs: nounwind
@@ -46,13 +46,13 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #4
 !1 = !DIFile(filename: "csmith107.i.c", directory: "/tmp")
 !2 = !{}
 !3 = !{!4, !6, !10}
-!4 = !DIGlobalVariable(name: "a", scope: null, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, variable: i16* @a)
+!4 = !DIGlobalVariable(name: "a", scope: null, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 16, align: 16, encoding: DW_ATE_signed)
-!6 = !DIGlobalVariable(name: "b", scope: null, file: !1, line: 3, type: !7, isLocal: false, isDefinition: true, variable: i32* @b)
+!6 = !DIGlobalVariable(name: "b", scope: null, file: !1, line: 3, type: !7, isLocal: false, isDefinition: true)
 !7 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint32_t", file: !1, line: 1, baseType: !8)
 !8 = !DIDerivedType(tag: DW_TAG_typedef, name: "__u32_t", file: !1, baseType: !9)
 !9 = !DIBasicType(name: "unsigned long", size: 32, align: 16, encoding: DW_ATE_unsigned)
-!10 = !DIGlobalVariable(name: "c", scope: null, file: !1, line: 4, type: !11, isLocal: false, isDefinition: true, variable: i16** @c)
+!10 = !DIGlobalVariable(name: "c", scope: null, file: !1, line: 4, type: !11, isLocal: false, isDefinition: true)
 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 16, align: 16)
 !12 = !{i32 2, !"Dwarf Version", i32 4}
 !13 = !{i32 2, !"Debug Info Version", i32 3}
index cb6c26e..0d08627 100644 (file)
@@ -2,7 +2,7 @@
 
 ; CHECK-NOT: call void @llvm.dbg.value
 
-@x = common global i32 0                          ; <i32*> [#uses=0]
+@x = common global i32 0, !dbg !8                          ; <i32*> [#uses=0]
 
 define void @foo() nounwind readnone optsize ssp !dbg !0 {
 entry:
@@ -23,7 +23,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
 !5 = !DILocalVariable(name: "y", line: 3, scope: !6, file: !1, type: !7)
 !6 = distinct !DILexicalBlock(line: 2, column: 0, file: !12, scope: !0)
 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!8 = !DIGlobalVariable(name: "x", line: 1, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !7, variable: i32* @x)
+!8 = !DIGlobalVariable(name: "x", line: 1, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !7)
 !9 = !{i32 0}
 !10 = !DILocation(line: 3, scope: !6)
 !11 = !DILocation(line: 4, scope: !6)
index 9107480..2116db4 100644 (file)
@@ -4,7 +4,7 @@
 ; CHECK-NOT: "bar"
 ; CHECK-NOT: "abcd"
 
-@xyz = global i32 2
+@xyz = global i32 2, !dbg !17
 
 ; Function Attrs: nounwind readnone
 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
@@ -47,7 +47,7 @@ attributes #2 = { nounwind readonly ssp }
 !14 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !3)
 !15 = !DILocalVariable(name: "i", line: 7, arg: 1, scope: !10, file: !5, type: !9)
 !16 = !DIGlobalVariable(name: "abcd", line: 2, isLocal: true, isDefinition: true, scope: !5, file: !5, type: !9)
-!17 = !DIGlobalVariable(name: "xyz", line: 3, isLocal: false, isDefinition: true, scope: !5, file: !5, type: !9, variable: i32* @xyz)
+!17 = !DIGlobalVariable(name: "xyz", line: 3, isLocal: false, isDefinition: true, scope: !5, file: !5, type: !9)
 !18 = !DILocation(line: 6, scope: !19)
 !19 = distinct !DILexicalBlock(line: 6, column: 0, file: !1, scope: !6)
 !20 = !DILocation(line: 7, scope: !10)
index 2e4e035..461db5a 100644 (file)
@@ -7,7 +7,7 @@ source_filename = "source-interleave-hexagon.c"
 target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
 target triple = "hexagon-unknown--elf"
 
-@a = global i32 1, align 4
+@a = global i32 1, align 4, !dbg !4
 
 ; Function Attrs: nounwind
 define i32 @foo() #0 !dbg !9 {
@@ -45,7 +45,7 @@ attributes #1 = { nounwind readnone }
 !1 = !DIFile(filename: "source-interleave-hexagon.c", directory: "SRC_COMPDIR")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @a)
+!4 = distinct !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !6 = !{i32 2, !"Dwarf Version", i32 4}
 !7 = !{i32 2, !"Debug Info Version", i32 3}
index 6030a90..09f1636 100644 (file)
@@ -8,7 +8,7 @@ source_filename = "source-interleave-x86_64.c"
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@a = global i32 1, align 4
+@a = global i32 1, align 4, !dbg !4
 
 ; Function Attrs: nounwind uwtable
 define i32 @foo() #0 !dbg !9 {
@@ -46,7 +46,7 @@ attributes #1 = { nounwind readnone }
 !1 = !DIFile(filename: "source-interleave-x86_64.c", directory: "SRC_COMPDIR")
 !2 = !{}
 !3 = !{!4}
-!4 = distinct !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @a)
+!4 = distinct !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true)
 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 !6 = !{i32 2, !"Dwarf Version", i32 4}
 !7 = !{i32 2, !"Debug Info Version", i32 3}
index def2dde..4213d51 100644 (file)
@@ -1820,13 +1820,14 @@ TEST_F(DIGlobalVariableTest, get) {
   DIType *Type = getDerivedType();
   bool IsLocalToUnit = false;
   bool IsDefinition = true;
-  Constant *Variable = getConstant();
+  auto *Expr = DIExpression::get(Context, {1, 2});
+  auto *Expr2 = DIExpression::get(Context, {1, 2, 3});
   DIDerivedType *StaticDataMemberDeclaration =
       cast<DIDerivedType>(getDerivedType());
 
   auto *N = DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
-                                  Type, IsLocalToUnit, IsDefinition, Variable,
-                                  StaticDataMemberDeclaration);
+                                  Type, IsLocalToUnit, IsDefinition,
+                                  Expr, StaticDataMemberDeclaration);
   EXPECT_EQ(dwarf::DW_TAG_variable, N->getTag());
   EXPECT_EQ(Scope, N->getScope());
   EXPECT_EQ(Name, N->getName());
@@ -1836,47 +1837,46 @@ TEST_F(DIGlobalVariableTest, get) {
   EXPECT_EQ(Type, N->getType());
   EXPECT_EQ(IsLocalToUnit, N->isLocalToUnit());
   EXPECT_EQ(IsDefinition, N->isDefinition());
-  EXPECT_EQ(Variable, N->getVariable());
+  EXPECT_EQ(Expr, N->getExpr());
   EXPECT_EQ(StaticDataMemberDeclaration, N->getStaticDataMemberDeclaration());
   EXPECT_EQ(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
                                      Line, Type, IsLocalToUnit, IsDefinition,
-                                     Variable, StaticDataMemberDeclaration));
+                                     Expr, StaticDataMemberDeclaration));
 
   EXPECT_NE(N,
             DIGlobalVariable::get(Context, getSubprogram(), Name, LinkageName,
                                   File, Line, Type, IsLocalToUnit, IsDefinition,
-                                  Variable, StaticDataMemberDeclaration));
+                                  Expr, StaticDataMemberDeclaration));
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, "other", LinkageName, File,
                                      Line, Type, IsLocalToUnit, IsDefinition,
-                                     Variable, StaticDataMemberDeclaration));
+                                     Expr, StaticDataMemberDeclaration));
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, "other", File, Line,
-                                     Type, IsLocalToUnit, IsDefinition,
-                                     Variable, StaticDataMemberDeclaration));
+                                     Type, IsLocalToUnit, IsDefinition, Expr,
+                                     StaticDataMemberDeclaration));
   EXPECT_NE(N,
             DIGlobalVariable::get(Context, Scope, Name, LinkageName, getFile(),
-                                  Line, Type, IsLocalToUnit, IsDefinition,
-                                  Variable, StaticDataMemberDeclaration));
+                                  Line, Type, IsLocalToUnit, IsDefinition, Expr,
+                                  StaticDataMemberDeclaration));
   EXPECT_NE(N,
             DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
                                   Line + 1, Type, IsLocalToUnit, IsDefinition,
-                                  Variable, StaticDataMemberDeclaration));
+                                  Expr, StaticDataMemberDeclaration));
   EXPECT_NE(N,
             DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
                                   getDerivedType(), IsLocalToUnit, IsDefinition,
-                                  Variable, StaticDataMemberDeclaration));
+                                  Expr, StaticDataMemberDeclaration));
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
                                      Line, Type, !IsLocalToUnit, IsDefinition,
-                                     Variable, StaticDataMemberDeclaration));
+                                     Expr, StaticDataMemberDeclaration));
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
                                      Line, Type, IsLocalToUnit, !IsDefinition,
-                                     Variable, StaticDataMemberDeclaration));
-  EXPECT_NE(N,
-            DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
-                                  Type, IsLocalToUnit, IsDefinition,
-                                  getConstant(), StaticDataMemberDeclaration));
+                                     Expr, StaticDataMemberDeclaration));
+  EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
+                                     Line, Type, IsLocalToUnit, IsDefinition,
+                                     Expr2, StaticDataMemberDeclaration));
   EXPECT_NE(N,
             DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
-                                  Type, IsLocalToUnit, IsDefinition, Variable,
+                                  Type, IsLocalToUnit, IsDefinition, Expr,
                                   cast<DIDerivedType>(getDerivedType())));
 
   TempDIGlobalVariable Temp = N->clone();
index c33c92a..96c32f2 100644 (file)
@@ -121,31 +121,6 @@ TEST(VerifierTest, CrossModuleRef) {
   F3->eraseFromParent();
 }
 
-TEST(VerifierTest, CrossModuleMetadataRef) {
-  LLVMContext C;
-  Module M1("M1", C);
-  Module M2("M2", C);
-  GlobalVariable *newGV =
-      new GlobalVariable(M1, Type::getInt8Ty(C), false,
-                         GlobalVariable::ExternalLinkage, nullptr,
-                         "Some Global");
-
-  DIBuilder dbuilder(M2);
-  auto CU = dbuilder.createCompileUnit(dwarf::DW_LANG_Julia, "test.jl", ".",
-                                       "unittest", false, "", 0);
-  auto File = dbuilder.createFile("test.jl", ".");
-  auto Ty = dbuilder.createBasicType("Int8", 8, 8, dwarf::DW_ATE_signed);
-  dbuilder.createGlobalVariable(CU, "_SOME_GLOBAL", "_SOME_GLOBAL", File, 1, Ty,
-                                false, newGV);
-  dbuilder.finalize();
-
-  std::string Error;
-  raw_string_ostream ErrorOS(Error);
-  EXPECT_TRUE(verifyModule(M2, &ErrorOS));
-  EXPECT_TRUE(StringRef(ErrorOS.str())
-                  .startswith("Referencing global in another module!"));
-}
-
 TEST(VerifierTest, InvalidVariableLinkage) {
   LLVMContext C;
   Module M("M", C);