[llvm] r266102 - [IR/Verifier] Each DISubprogram with isDefinition: true must belong to a CU.

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 11:16:00 PDT 2016


> On Apr 13, 2016, at 11:14 AM, Davide Italiano <davide at freebsd.org> wrote:
> 
> On Wed, Apr 13, 2016 at 10:51 AM, Adam Nemet <anemet at apple.com> wrote:
>> Hi Davide,
>> 
>> This seems like the most likely culprit in the recent timeouts (> 2x) with our LTO builds:
>> 
>> http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto/8468/
>> 
>> Can you please revert?
>> 
>> Thanks,
>> Adam
>> 
> 
> Sorry Adam, r266221.

Thanks, Davide!

> 
>>> On Apr 12, 2016, at 11:22 AM, Davide Italiano via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>> 
>>> Author: davide
>>> Date: Tue Apr 12 13:22:33 2016
>>> New Revision: 266102
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=266102&view=rev
>>> Log:
>>> [IR/Verifier] Each DISubprogram with isDefinition: true must belong to a CU.
>>> 
>>> Add a check to catch violations. ~60 tests were broken and prevented
>>> this change to be committed. Adrian and I (thanks Adrian!) went
>>> through them in the last week or so updating. The check can be
>>> done more efficiently but I'd still like to get this in ASAP to
>>> avoid more broken tests to be checked in (if any).
>>> 
>>> PR:  27101
>>> 
>>> Added:
>>>   llvm/trunk/test/Verifier/disubprogram-nocu.ll
>>> Modified:
>>>   llvm/trunk/lib/IR/Verifier.cpp
>>> 
>>> Modified: llvm/trunk/lib/IR/Verifier.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=266102&r1=266101&r2=266102&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/IR/Verifier.cpp (original)
>>> +++ llvm/trunk/lib/IR/Verifier.cpp Tue Apr 12 13:22:33 2016
>>> @@ -1011,6 +1011,22 @@ void Verifier::visitDISubprogram(const D
>>> 
>>>  if (N.isDefinition())
>>>    Assert(N.isDistinct(), "subprogram definitions must be distinct", &N);
>>> +
>>> +  // Ensure that every DISubprogram with isDefinition: true belongs
>>> +  // to a DICompileUnit.
>>> +  // FIXME: This is a very inefficient way of handling the problem.
>>> +  // Use a SmallSetPtr which contains the Listed DISubprograms in the CU
>>> +  // instead.
>>> +  if (N.isDefinition()) {
>>> +    auto *CUs = M->getNamedMetadata("llvm.dbg.cu");
>>> +    Assert(CUs, "subprogram must belong to a compile unit", &N);
>>> +    for (auto *CU : CUs->operands())
>>> +      if (auto Subprograms = cast<DICompileUnit>(CU)->getSubprograms())
>>> +        for (const auto *Sp : Subprograms)
>>> +          if (Sp == &N)
>>> +            return;
>>> +    Assert(false, "subprogram not found in any compile unit", &N);
>>> +  }
>>> }
>>> 
>>> void Verifier::visitDILexicalBlockBase(const DILexicalBlockBase &N) {
>>> 
>>> Added: llvm/trunk/test/Verifier/disubprogram-nocu.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/disubprogram-nocu.ll?rev=266102&view=auto
>>> ==============================================================================
>>> --- llvm/trunk/test/Verifier/disubprogram-nocu.ll (added)
>>> +++ llvm/trunk/test/Verifier/disubprogram-nocu.ll Tue Apr 12 13:22:33 2016
>>> @@ -0,0 +1,22 @@
>>> +; Reject if DISubprogram does not belong to a DICompileUnit.
>>> +; RUN: not llvm-as %s
>>> +
>>> + at _ZZNK4llvm6object15MachOObjectFile21getRelocationTypeNameENS0_11DataRefImplERNS_15SmallVectorImplIcEEE5Table = external unnamed_addr constant [6 x i8*], align 16
>>> +
>>> +!llvm.dbg.cu = !{!0}
>>> +!llvm.module.flags = !{!13}
>>> +
>>> +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: 0, globals: !2, imports: !9)
>>> +!1 = !DIFile(filename: "../lib/Object/MachOObjectFile.cpp", directory: "/home/davide/work/llvm/build-lto-debug")
>>> +!2 = !{!3, !8}
>>> +!3 = !DIGlobalVariable(name: "Table", scope: !4, isLocal: false, isDefinition: true, variable: [6 x i8*]* @_ZZNK4llvm6object15MachOObjectFile21getRelocationTypeNameENS0_11DataRefImplERNS_15SmallVectorImplIcEEE5Table)
>>> +!4 = distinct !DILexicalBlock(scope: !5, line: 722, column: 23)
>>> +!5 = distinct !DILexicalBlock(scope: !6, line: 721, column: 17)
>>> +!6 = distinct !DISubprogram(name: "getRelocationTypeName", scope: null, isLocal: false, isDefinition: true, isOptimized: false, variables: !7)
>>> +!7 = !{}
>>> +!8 = !DIGlobalVariable(name: "IsLittleEndianHost", scope: null, isLocal: false, isDefinition: true, variable: i1 true)
>>> +!9 = !{!10, !12}
>>> +!10 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !11, line: 121)
>>> +!11 = !DINamespace(name: "std", scope: null, line: 1967)
>>> +!12 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0, line: 32)
>>> +!13 = !{i32 2, !"Debug Info Version", i32 3}
>>> 
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>> 
> 
> 
> 
> -- 
> Davide
> 
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare



More information about the llvm-commits mailing list