[llvm] r209178 - DebugInfo: Assume all subprogram DIEs have been created before any abstract subprograms are constructed.

David Blaikie dblaikie at gmail.com
Tue May 20 16:05:53 PDT 2014


Reverted in r209251 because it's a pretty small/simple change, but I'd
still love some help with a reproduction (though I'm trying to get an
LLVM gold plugin setup working... )

My rationale for why this /shouldn't/ be a problem (though it obviously is):

constructAbstractSubprogramScopeDIE happens during
DwarfDebug::endFunction for any debug-enabled function that is inlined
into the current function.

DwarfDebug::endFunction happens after DwarfDebug::beginModule.

In DwarfDebug::beginModule visits all compilation units and all
subprograms in the subprogram lists of each CU. For each of those
subprograms the basic definition DIE is constructed (without
high/low_pc, etc - those are deferred until DwarfDebug::endFunction).

So by the time we get around to costructAbstractSubprogramScopeDIE we
should've already visited the function in beginModule and we should be
assured that it exists in the map.

Any idea where this hypothesis goes off the rails? Do you know which
CU the subprogram is a member of? Is the subprogram in the CU's
subprogram list? Any idea why not (if it isn't)?

On Tue, May 20, 2014 at 2:15 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Any chance of a smaller reproduction? This may take me a while to reproduce...
>
> On Tue, May 20, 2014 at 1:44 PM, Adrian Prantl <aprantl at apple.com> wrote:
>>
>>> On May 19, 2014, at 4:16 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>>
>>> Author: dblaikie
>>> Date: Mon May 19 18:16:19 2014
>>> New Revision: 209178
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=209178&view=rev
>>> Log:
>>> DebugInfo: Assume all subprogram DIEs have been created before any abstract subprograms are constructed.
>>>
>>> Since we visit the whole list of subprograms for each CU at module
>>> start, this is clearly true - don't test for the case, just assert it.
>>>
>>> A few old test cases seemed to have incomplete subprogram lists, but any
>>> attempt to reproduce them shows full subprogram lists that even include
>>> entities that have been completely inlined and the out of line
>>> definition removed.
>>>
>>> Modified:
>>>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>    llvm/trunk/test/CodeGen/X86/stack-protector-dbginfo.ll
>>>    llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll
>>>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=209178&r1=209177&r2=209178&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon May 19 18:16:19 2014
>>> @@ -552,11 +552,11 @@ void DwarfDebug::constructAbstractSubpro
>>>   if (!ProcessedSPNodes.insert(Sub))
>>>     return;
>>>
>>> -  if (DIE *ScopeDIE = TheCU.getDIE(Sub)) {
>>> -    AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
>>> -    TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
>>> -    createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
>>> -  }
>>> +  DIE *ScopeDIE = TheCU.getDIE(Sub);
>>> +  assert(ScopeDIE);
>>
>> Hi David,
>>
>> our buildbots noticed that this assertion fails when doing a bootstrapped LTO build of clang.
>> To reproduce this on ToT r209227:
>> 1) Build a +Asserts build of clang
>> 2) Configure a separate build directory to append -flto to CXX_FLAGS using the libLTO built in stage 1
>> 3) Build llvm (or quicker, just the FileUpdate target)
>> 4) Observe
>> ... -o bin/FileUpdate  lib/libLLVMSupport.a -lcurses -lpthread -lz -Wl,-rpath, at executable_path/../lib && :
>> !{i32 786478, metadata <badref>, metadata <badref>, metadata !"PrintStackTraceOnErrorSignal", metadata !"PrintStackTraceOnErrorSignal", metadata !"_ZN4llvm3sys28PrintStackTraceOnErrorSignalEv", i32 333, metadata <badref>, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, null, null, null, metadata <badref>, i32 333} ; [ DW_TAG_subprogram ] [line 333] [def] [PrintStackTraceOnErrorSignal]
>>
>> Assertion failed: (ScopeDIE), function constructAbstractSubprogramScopeDIE, file ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp, line 538.
>>
>> Note: I added
>>   if (!ScopeDIE) Sub->dump();
>> before
>>   assert(ScopeDIE);
>> to generate the above output.
>>
>> Please revert or fix this soon.
>>
>> thanks,
>> Adrian
>>
>>> +  AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
>>> +  TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
>>> +  createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
>>> }
>>>
>>> DIE &DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU,
>>>
>>> Modified: llvm/trunk/test/CodeGen/X86/stack-protector-dbginfo.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/stack-protector-dbginfo.ll?rev=209178&r1=209177&r2=209178&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/CodeGen/X86/stack-protector-dbginfo.ll (original)
>>> +++ llvm/trunk/test/CodeGen/X86/stack-protector-dbginfo.ll Mon May 19 18:16:19 2014
>>> @@ -33,7 +33,7 @@ attributes #0 = { sspreq }
>>> !5 = metadata !{}
>>> !6 = metadata !{metadata !7}
>>> !7 = metadata !{i32 786472, metadata !"max_frame_size", i64 0} ; [ DW_TAG_enumerator ] [max_frame_size :: 0]
>>> -!8 = metadata !{metadata !9}
>>> +!8 = metadata !{metadata !9, metadata !24, metadata !41, metadata !65}
>>> !9 = metadata !{i32 786478, metadata !1, metadata !10, metadata !"read_response_size", metadata !"read_response_size", metadata !"_Z18read_response_sizev", i32 27, metadata !11, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 ()* @_Z18read_response_sizev, null, null, metadata !14, i32 27} ; [ DW_TAG_subprogram ] [line 27] [def] [read_response_size]
>>> !10 = metadata !{i32 786473, metadata !1}         ; [ DW_TAG_file_type ] [/Users/matt/ryan_bug/<unknown>]
>>> !11 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
>>>
>>> Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll?rev=209178&r1=209177&r2=209178&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll (original)
>>> +++ llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll Mon May 19 18:16:19 2014
>>> @@ -71,7 +71,7 @@ declare void @llvm.dbg.value(metadata, i
>>> !18 = metadata !{i32 786443, metadata !26, metadata !0, i32 19510, i32 1, i32 99} ; [ DW_TAG_lexical_block ]
>>> !22 = metadata !{i32 18094, i32 2, metadata !15, metadata !17}
>>> !23 = metadata !{i32 19524, i32 1, metadata !18, null}
>>> -!24 = metadata !{metadata !0, metadata !6, metadata !7, metadata !8}
>>> +!24 = metadata !{metadata !0, metadata !6, metadata !7, metadata !8, metadata !16}
>>> !25 = metadata !{i32 786473, metadata !27} ; [ DW_TAG_file_type ]
>>> !26 = metadata !{metadata !"/tmp/f.c", metadata !"/tmp"}
>>> !27 = metadata !{metadata !"f.i", metadata !"/tmp"}
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>




More information about the llvm-commits mailing list