[IR] Remove the DIExpression field from DIGlobalVariable.
authorAdrian Prantl <aprantl@apple.com>
Fri, 16 Dec 2016 00:36:43 +0000 (00:36 +0000)
committerAdrian Prantl <aprantl@apple.com>
Fri, 16 Dec 2016 00:36:43 +0000 (00:36 +0000)
commitce13935776a67c6bf7fffc3a0db76d27bfbd050a
tree35634382729a60f610a4e72f5e511d75971f719a
parent35bbcefb4be62f6f5a9630d8f0664c97e52b2b20
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

llvm-svn: 289902
188 files changed:
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfo.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/GlobalVariable.h
llvm/include/llvm/IR/Metadata.def
llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/IR/Metadata.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/IPO/StripSymbols.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/test/Assembler/diglobalvariable.ll
llvm/test/Assembler/diglobalvariableexpression.ll [new file with mode: 0644]
llvm/test/Bitcode/DIGlobalVariableExpr.ll [new file with mode: 0644]
llvm/test/Bitcode/DIGlobalVariableExpr.ll.bc [new file with mode: 0644]
llvm/test/Bitcode/diglobalvariable-3.8.ll
llvm/test/Bitcode/diglobalvariable-3.8.ll.bc
llvm/test/Bitcode/dityperefs-3.8.ll
llvm/test/CodeGen/AArch64/arm64-2011-03-17-AsmPrinterCrash.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/BPF/dwarfdump.ll
llvm/test/CodeGen/NVPTX/generic-to-nvvm-ir.ll
llvm/test/CodeGen/PowerPC/pr17168.ll
llvm/test/CodeGen/WebAssembly/dbgvalue.ll
llvm/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
llvm/test/CodeGen/X86/fp128-g.ll
llvm/test/CodeGen/X86/fpstack-debuginstr-kill.ll
llvm/test/CodeGen/X86/misched-code-difference-with-debug.ll
llvm/test/CodeGen/X86/null-streamer.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/int8-char-type.ll
llvm/test/DebugInfo/COFF/long-type-name.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-05-DeadGlobalVariable.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/global.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/MIR/X86/mlicm-hoist.mir
llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll
llvm/test/DebugInfo/PowerPC/tls-fission.ll
llvm/test/DebugInfo/PowerPC/tls.ll
llvm/test/DebugInfo/WebAssembly/dbg-declare.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/align_c11.ll
llvm/test/DebugInfo/X86/align_cpp11.ll
llvm/test/DebugInfo/X86/align_objc.ll
llvm/test/DebugInfo/X86/arange-and-stub.ll
llvm/test/DebugInfo/X86/arange.ll
llvm/test/DebugInfo/X86/atomic-c11-dwarf-4.ll
llvm/test/DebugInfo/X86/atomic-c11-dwarf-5.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/inline-namespace.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/split-global.ll [new file with mode: 0644]
llvm/test/DebugInfo/X86/stack-value-dwarf4.ll
llvm/test/DebugInfo/X86/static_member_array.ll
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
llvm/test/DebugInfo/X86/union-template.ll
llvm/test/DebugInfo/X86/vector.ll
llvm/test/Instrumentation/AddressSanitizer/debug-info-global-var.ll
llvm/test/LTO/X86/Inputs/type-mapping-src.ll
llvm/test/LTO/X86/type-mapping-bug.ll
llvm/test/Linker/2011-08-04-Metadata.ll
llvm/test/Linker/2011-08-04-Metadata2.ll
llvm/test/Linker/debug-info-global-var.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/crash_debuginfo.ll
llvm/test/ThinLTO/X86/debuginfo-cu-import.ll
llvm/test/Transforms/GCOVProfiling/return-block.ll
llvm/test/Transforms/GlobalMerge/debug-info.ll
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/2010-08-25-crash.ll
llvm/test/Transforms/StripSymbols/strip-dead-debug-info.ll
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-containingtypes.ll
llvm/test/Verifier/diglobalvariable.ll [new file with mode: 0644]
llvm/unittests/IR/MetadataTest.cpp