[PATCH] D28005: Add a unit field to DIGlobalVariable, mirroring the design of DISubprogram.

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 16:31:52 PST 2016


> On Dec 20, 2016, at 4:30 PM, Adrian Prantl <aprantl at apple.com> wrote:
> 
> 
>> On Dec 20, 2016, at 4:24 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> 
>> Based on the discussion about DISubprogram deduplication for inline functions in (all flavors of) LTO - could we make this unit link null for non-external (well, specifically globals that can be duplicated - linkonce_odr and the like) & just emit those into whichever CU references them first?
>> This would avoid redundant descriptions (where all but one lacks any location description, etc) of deduplicable globals. Though perhaps it's a non-issue for globals, since they aren't inlined - but they could be reduced to a constant which is sort of the same.
>> 
>> I can explain/provide examples if I'm being vague/hand-wavy.
> 
> How do I generate linkonce_odr global variable with clang? I would like to experiment with this a bit before I can answer your question.

Any template instantiation.

— 
Mehdi


> 
> thanks,
> Adrian
> 
> 
>> 
>> On Tue, Dec 20, 2016 at 4:16 PM Adrian Prantl via Phabricator <reviews at reviews.llvm.org> wrote:
>> aprantl created this revision.
>> aprantl added reviewers: dexonsmith, dblaikie.
>> aprantl added a subscriber: llvm-commits.
>> Herald added subscribers: nemanjai, mehdi_amini, sanjoy, jfb, jholewinski.
>> 
>> This has been suggested as an incremental follow-up to https://reviews.llvm.org/D26769.
>> 
>> Adding a unit field to DIGlobalVariable makes the design consistent with the design of DISubprogram
>> (DISubprogram **definitions** that are attached to Functions also have a unit field).
>> It also allows us to more efficiently process global variables in the DWARF backend.
>> 
>> After this patch, global variables occur in three forms in the debug info metadata:
>> 
>> 1. **Variable definitions** are reachable via a !dbg attachment on a global that points to a DIGlobalVariableExpression which points to a distinct DIGlobalVariable (and an optional DIExpression) with a unit field pointing to the variable's DICompileUnit.
>> 
>> 2. **Constant definitions** are reachable via the DICompileUnit's list of globals which points to a DIGlobalVariableExpression with a DIGlobalVariable without a unit field and a DIExpression describing a constant value.
>> 
>> 3. **Declarations** are DIGlobalVariables without a unit field that are only reachable via a DIImportedEntity and have isDefinition set to false.
>> 
>> 
>> https://reviews.llvm.org/D28005
>> 
>> Files:
>>  docs/SourceLevelDebugging.rst
>>  include/llvm/IR/DebugInfoMetadata.h
>>  lib/AsmParser/LLParser.cpp
>>  lib/Bitcode/Reader/MetadataLoader.cpp
>>  lib/Bitcode/Writer/BitcodeWriter.cpp
>>  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>  lib/IR/AsmWriter.cpp
>>  lib/IR/DIBuilder.cpp
>>  lib/IR/DebugInfoMetadata.cpp
>>  lib/IR/LLVMContextImpl.h
>>  lib/IR/Verifier.cpp
>>  test/Bitcode/diglobalvariable-3.8.ll
>>  test/CodeGen/AArch64/arm64-2011-03-17-AsmPrinterCrash.ll
>>  test/CodeGen/ARM/2010-06-25-Thumb2ITInvalidIterator.ll
>>  test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
>>  test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
>>  test/CodeGen/ARM/coalesce-dbgvalue.ll
>>  test/CodeGen/BPF/dwarfdump.ll
>>  test/CodeGen/NVPTX/generic-to-nvvm-ir.ll
>>  test/CodeGen/PowerPC/pr17168.ll
>>  test/CodeGen/PowerPC/pr24546.ll
>>  test/CodeGen/WebAssembly/dbgvalue.ll
>>  test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
>>  test/CodeGen/X86/fp128-g.ll
>>  test/CodeGen/X86/fpstack-debuginstr-kill.ll
>>  test/CodeGen/X86/misched-code-difference-with-debug.ll
>>  test/CodeGen/X86/null-streamer.ll
>>  test/DebugInfo/AArch64/big-endian.ll
>>  test/DebugInfo/AArch64/bitfields.ll
>>  test/DebugInfo/AArch64/frameindices.ll
>>  test/DebugInfo/ARM/big-endian-bitfield.ll
>>  test/DebugInfo/ARM/bitfield.ll
>>  test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
>>  test/DebugInfo/ARM/tls.ll
>>  test/DebugInfo/COFF/anonymous-struct.ll
>>  test/DebugInfo/COFF/big-type.ll
>>  test/DebugInfo/COFF/bitfields.ll
>>  test/DebugInfo/COFF/enum.ll
>>  test/DebugInfo/COFF/global-dllimport.ll
>>  test/DebugInfo/COFF/globals-discarded.ll
>>  test/DebugInfo/COFF/globals.ll
>>  test/DebugInfo/COFF/inheritance.ll
>>  test/DebugInfo/COFF/inlining-files.ll
>>  test/DebugInfo/COFF/inlining-header.ll
>>  test/DebugInfo/COFF/inlining-levels.ll
>>  test/DebugInfo/COFF/int8-char-type.ll
>>  test/DebugInfo/COFF/long-type-name.ll
>>  test/DebugInfo/COFF/register-variables.ll
>>  test/DebugInfo/COFF/scopes.ll
>>  test/DebugInfo/COFF/types-array-advanced.ll
>>  test/DebugInfo/COFF/types-nested-class.ll
>>  test/DebugInfo/COFF/types-ptr-to-member.ll
>>  test/DebugInfo/COFF/udts.ll
>>  test/DebugInfo/COFF/virtual-method-kinds.ll
>>  test/DebugInfo/COFF/vtable-optzn-array.ll
>>  test/DebugInfo/Generic/2009-11-05-DeadGlobalVariable.ll
>>  test/DebugInfo/Generic/2009-11-06-NamelessGlobalVariable.ll
>>  test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
>>  test/DebugInfo/Generic/accel-table-hash-collisions.ll
>>  test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
>>  test/DebugInfo/Generic/cross-cu-linkonce.ll
>>  test/DebugInfo/Generic/dbg-at-specficiation.ll
>>  test/DebugInfo/Generic/debuginfofinder-forward-declaration.ll
>>  test/DebugInfo/Generic/dwarf-public-names.ll
>>  test/DebugInfo/Generic/enum.ll
>>  test/DebugInfo/Generic/global.ll
>>  test/DebugInfo/Generic/gvn.ll
>>  test/DebugInfo/Generic/member-pointers.ll
>>  test/DebugInfo/Generic/namespace.ll
>>  test/DebugInfo/Generic/recursive_inlining.ll
>>  test/DebugInfo/Generic/template-recursive-void.ll
>>  test/DebugInfo/Generic/tu-member-pointer.ll
>>  test/DebugInfo/Generic/typedef.ll
>>  test/DebugInfo/MIR/X86/live-debug-values.mir
>>  test/DebugInfo/MIR/X86/mlicm-hoist.mir
>>  test/DebugInfo/Mips/InlinedFnLocalVar.ll
>>  test/DebugInfo/PowerPC/tls-fission.ll
>>  test/DebugInfo/PowerPC/tls.ll
>>  test/DebugInfo/WebAssembly/dbg-declare.ll
>>  test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
>>  test/DebugInfo/X86/DIModuleContext.ll
>>  test/DebugInfo/X86/DW_AT_calling-convention.ll
>>  test/DebugInfo/X86/DW_AT_specification.ll
>>  test/DebugInfo/X86/DW_TAG_friend.ll
>>  test/DebugInfo/X86/InlinedFnLocalVar.ll
>>  test/DebugInfo/X86/PR26148.ll
>>  test/DebugInfo/X86/align_c11.ll
>>  test/DebugInfo/X86/align_cpp11.ll
>>  test/DebugInfo/X86/align_objc.ll
>>  test/DebugInfo/X86/arange-and-stub.ll
>>  test/DebugInfo/X86/arange.ll
>>  test/DebugInfo/X86/atomic-c11-dwarf-4.ll
>>  test/DebugInfo/X86/atomic-c11-dwarf-5.ll
>>  test/DebugInfo/X86/bitfields-dwarf4.ll
>>  test/DebugInfo/X86/bitfields.ll
>>  test/DebugInfo/X86/c-type-units.ll
>>  test/DebugInfo/X86/concrete_out_of_line.ll
>>  test/DebugInfo/X86/cu-ranges-odr.ll
>>  test/DebugInfo/X86/data_member_location.ll
>>  test/DebugInfo/X86/dbg-subrange.ll
>>  test/DebugInfo/X86/dbg-value-inlined-parameter.ll
>>  test/DebugInfo/X86/dbg-value-regmask-clobber.ll
>>  test/DebugInfo/X86/debug-info-access.ll
>>  test/DebugInfo/X86/debug-info-packed-struct.ll
>>  test/DebugInfo/X86/debug-info-static-member.ll
>>  test/DebugInfo/X86/debug-loc-frame.ll
>>  test/DebugInfo/X86/debugger-tune.ll
>>  test/DebugInfo/X86/decl-derived-member.ll
>>  test/DebugInfo/X86/dllimport.ll
>>  test/DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll
>>  test/DebugInfo/X86/dwarf-aranges.ll
>>  test/DebugInfo/X86/dwarf-linkage-names.ll
>>  test/DebugInfo/X86/dwarf-public-names.ll
>>  test/DebugInfo/X86/empty-array.ll
>>  test/DebugInfo/X86/enum-class.ll
>>  test/DebugInfo/X86/enum-fwd-decl.ll
>>  test/DebugInfo/X86/externaltyperef.ll
>>  test/DebugInfo/X86/fission-cu.ll
>>  test/DebugInfo/X86/generate-odr-hash.ll
>>  test/DebugInfo/X86/gnu-public-names.ll
>>  test/DebugInfo/X86/inline-member-function.ll
>>  test/DebugInfo/X86/inline-namespace.ll
>>  test/DebugInfo/X86/inlined-indirect-value.ll
>>  test/DebugInfo/X86/isel-cse-line.ll
>>  test/DebugInfo/X86/linkage-name.ll
>>  test/DebugInfo/X86/live-debug-values.ll
>>  test/DebugInfo/X86/memberfnptr.ll
>>  test/DebugInfo/X86/misched-dbg-value.ll
>>  test/DebugInfo/X86/multiple-aranges.ll
>>  test/DebugInfo/X86/nondefault-subrange-array.ll
>>  test/DebugInfo/X86/objc-fwd-decl.ll
>>  test/DebugInfo/X86/pointer-type-size.ll
>>  test/DebugInfo/X86/ref_addr_relocation.ll
>>  test/DebugInfo/X86/split-global.ll
>>  test/DebugInfo/X86/stack-value-dwarf4.ll
>>  test/DebugInfo/X86/static_member_array.ll
>>  test/DebugInfo/X86/stringpool.ll
>>  test/DebugInfo/X86/struct-loc.ll
>>  test/DebugInfo/X86/template.ll
>>  test/DebugInfo/X86/tls.ll
>>  test/DebugInfo/X86/type_units_with_addresses.ll
>>  test/DebugInfo/X86/union-template.ll
>>  test/DebugInfo/X86/vector.ll
>>  test/Instrumentation/AddressSanitizer/debug-info-global-var.ll
>>  test/LTO/X86/Inputs/type-mapping-src.ll
>>  test/LTO/X86/type-mapping-bug.ll
>>  test/Linker/2011-08-04-Metadata.ll
>>  test/Linker/2011-08-04-Metadata2.ll
>>  test/Linker/debug-info-global-var.ll
>>  test/Linker/odr.ll
>>  test/Linker/only-needed-debug-metadata.ll
>>  test/ThinLTO/X86/Inputs/crash_debuginfo.ll
>>  test/ThinLTO/X86/crash_debuginfo.ll
>>  test/ThinLTO/X86/debuginfo-cu-import.ll
>>  test/Transforms/GCOVProfiling/return-block.ll
>>  test/Transforms/GlobalMerge/debug-info.ll
>>  test/Transforms/GlobalOpt/2009-03-05-dbg.ll
>>  test/Transforms/Inline/alloca-dbgdeclare.ll
>>  test/Transforms/LoopVectorize/dbg.value.ll
>>  test/Transforms/SampleProfile/cov-zero-samples.ll
>>  test/Transforms/SimplifyCFG/PR27615-simplify-cond-br.ll
>>  test/Transforms/StripSymbols/2010-06-30-StripDebug.ll
>>  test/Transforms/StripSymbols/2010-08-25-crash.ll
>>  test/Transforms/StripSymbols/strip-dead-debug-info.ll
>>  test/Transforms/Util/strip-nonlinetable-debuginfo-containingtypes.ll
>>  test/Verifier/DIGlobalVariable-no-unit.ll
>>  test/tools/llvm-objdump/Hexagon/source-interleave-hexagon.ll
>>  test/tools/llvm-objdump/X86/source-interleave-x86_64.ll
>>  unittests/IR/MetadataTest.cpp
>> 
> 



More information about the llvm-commits mailing list