Index: lib/IR/Verifier.cpp =================================================================== --- lib/IR/Verifier.cpp +++ lib/IR/Verifier.cpp @@ -196,6 +196,10 @@ /// \brief Keep track of the metadata nodes that have been checked already. SmallPtrSet MDNodes; + /// Track whether we should have already already seen all DISubprogram + /// definitions and added them to the above set. + bool DoneVisitingSPDefinitions; + /// \brief Track unresolved string-based type references. SmallDenseMap UnresolvedTypeRefs; @@ -221,8 +225,8 @@ const Instruction *I); public: explicit Verifier(raw_ostream &OS) - : VerifierSupport(OS), Context(nullptr), LandingPadResultTy(nullptr), - SawFrameEscape(false) {} + : VerifierSupport(OS), Context(nullptr), DoneVisitingSPDefinitions(false), + LandingPadResultTy(nullptr), SawFrameEscape(false) {} bool verify(const Function &F) { M = F.getParent(); @@ -304,9 +308,14 @@ // Verify type referneces last. verifyTypeRefs(); + // Clean up + DoneVisitingSPDefinitions = false; + return !Broken; } + bool recordSPDefinitions(const Module &M); + private: // Verification methods... void visitGlobalValue(const GlobalValue &GV); @@ -317,6 +326,7 @@ const GlobalAlias &A, const Constant &C); void visitNamedMDNode(const NamedMDNode &NMD); void visitMDNode(const MDNode &MD); + void visitMDNodeOperands(const MDNode &MD); void visitMetadataAsValue(const MetadataAsValue &MD, Function *F); void visitValueAsMetadata(const ValueAsMetadata &MD, Function *F); void visitComdat(const Comdat &C); @@ -661,16 +671,52 @@ void Verifier::visitNamedMDNode(const NamedMDNode &NMD) { for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i) { MDNode *MD = NMD.getOperand(i); + Assert(MD, "Named MD operands may not be null!", &NMD); + visitMDNode(*MD); + } +} - if (NMD.getName() == "llvm.dbg.cu") { - Assert(MD && isa(MD), "invalid compile unit", &NMD, MD); - } +bool Verifier::recordSPDefinitions(const Module &M) { + this->M = &M; + auto *CUs = M.getNamedMetadata("llvm.dbg.cu"); + if (!CUs) { + DoneVisitingSPDefinitions = true; + return true; + } - if (!MD) + // We want to collect all subprogram's referenced from any compile unit and + // visit them now, such that we can detect any subprogram definition that is + // referenced somewhere else but not declared here. + std::set SPs; + for (MDNode *Op : CUs->operands()) { + // Null Named MD operands are diagnosed elsewhere + if (!Op) continue; - - visitMDNode(*MD); + auto *CU = cast(Op); + auto *RawSPs = dyn_cast_or_null(CU->getRawSubprograms()); + // Wrong structure/types diagnosed elsewhere + if (!RawSPs) + continue; + for (const MDOperand &Op : RawSPs->operands()) { + DISubprogram *SP = dyn_cast_or_null(Op.get()); + if (!SP) + continue; + visitDISubprogram(*SP); + MDNodes.insert(SP); + SPs.insert(SP); + } } + + // From now on it's an error to reach a DISubprogram that's a definition, + // because all such should have been found above and inserted into MDNodes + DoneVisitingSPDefinitions = true; + + // Make sure to visit the DISubprogram's operands, otherwise, we'd never get + // to them. + for (auto *SP : SPs) + visitMDNodeOperands(*SP); + + return !Broken; } void Verifier::visitMDNode(const MDNode &MD) { @@ -691,6 +737,14 @@ #include "llvm/IR/Metadata.def" } + visitMDNodeOperands(MD); + + // Check these last, so we diagnose problems in operands first. + Assert(!MD.isTemporary(), "Expected no forward declarations!", &MD); + Assert(MD.isResolved(), "All nodes should be resolved!", &MD); +} + +void Verifier::visitMDNodeOperands(const MDNode &MD) { for (unsigned i = 0, e = MD.getNumOperands(); i != e; ++i) { Metadata *Op = MD.getOperand(i); if (!Op) @@ -706,10 +760,6 @@ continue; } } - - // Check these last, so we diagnose problems in operands first. - Assert(!MD.isTemporary(), "Expected no forward declarations!", &MD); - Assert(MD.isResolved(), "All nodes should be resolved!", &MD); } void Verifier::visitValueAsMetadata(const ValueAsMetadata &MD, Function *F) { @@ -1001,8 +1051,12 @@ Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags", &N); - if (N.isDefinition()) + if (N.isDefinition()) { Assert(N.isDistinct(), "subprogram definitions must be distinct", &N); + Assert(!DoneVisitingSPDefinitions, "All subprogram definitions must be " + "referenced from llvm.dbg.cu metadata", + &N); + } } void Verifier::visitDILexicalBlockBase(const DILexicalBlockBase &N) { @@ -4239,10 +4293,12 @@ return; // Visit all the compile units again to map the type references. + // Incorrect types/structure are detected elsewhere. SmallDenseMap TypeRefs; for (auto *CU : CUs->operands()) - if (auto Ts = cast(CU)->getRetainedTypes()) - for (DIType *Op : Ts) + if (auto Ts = dyn_cast_or_null( + cast(CU)->getRawRetainedTypes())) + for (Metadata *Op : Ts->operands()) if (auto *T = dyn_cast_or_null(Op)) if (auto *S = T->getRawIdentifier()) { UnresolvedTypeRefs.erase(S); @@ -4296,8 +4352,12 @@ bool llvm::verifyModule(const Module &M, raw_ostream *OS) { raw_null_ostream NullStr; Verifier V(OS ? *OS : NullStr); - bool Broken = false; + + // Record all DISubprogram's such that we can properly diagnose them when we + // reach them while verifying functions. + Broken |= !V.recordSPDefinitions(M); + for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isDeclaration() && !I->isMaterializable()) Broken |= !V.verify(*I); Index: test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll =================================================================== --- test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll +++ test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll @@ -31,9 +31,10 @@ !2 = !DIFile(filename: "/d/j/debug-test.c", directory: "/Volumes/Data/b") !3 = !DISubroutineType(types: !4) !4 = !{!5} -!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 64, align: 64, encoding: DW_ATE_signed) !8 = !DIFile(filename: "/d/j/debug-test.c", directory: "/Volumes/Data/b") -!9 = !{i32 0} +!9 = !{} !llvm.module.flags = !{!10} +!llvm.dbg.cu = !{!6} !10 = !{i32 1, !"Debug Info Version", i32 3} Index: test/Assembler/diimportedentity.ll =================================================================== --- test/Assembler/diimportedentity.ll +++ test/Assembler/diimportedentity.ll @@ -6,7 +6,7 @@ ; CHECK: !0 = distinct !DISubprogram({{.*}}) ; CHECK-NEXT: !1 = !DICompositeType({{.*}}) -!0 = distinct !DISubprogram(name: "foo") +!0 = distinct !DISubprogram(name: "foo", isDefinition: false) !1 = !DICompositeType(tag: DW_TAG_structure_type, name: "Class", size: 32, align: 32) ; CHECK-NEXT: !2 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0, entity: !1, line: 7) @@ -17,4 +17,3 @@ !3 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0) !4 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "", scope: !0, entity: null, line: 0) - Index: test/Assembler/dilexicalblock.ll =================================================================== --- test/Assembler/dilexicalblock.ll +++ test/Assembler/dilexicalblock.ll @@ -5,7 +5,7 @@ !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9} !0 = distinct !{} -!1 = distinct !DISubprogram(name: "foo", scope: !2) +!1 = distinct !DISubprogram(name: "foo", scope: !2, isDefinition: false) !2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir") ; CHECK: !3 = !DILexicalBlock(scope: !1, file: !2, line: 7, column: 35) Index: test/Assembler/dilocalvariable-arg-large.ll =================================================================== --- test/Assembler/dilocalvariable-arg-large.ll +++ test/Assembler/dilocalvariable-arg-large.ll @@ -4,7 +4,7 @@ ; CHECK: !named = !{!0, !1} !named = !{!0, !1} -!0 = distinct !DISubprogram() +!0 = distinct !DISubprogram(isDefinition: false) ; CHECK: !1 = !DILocalVariable(name: "foo", arg: 65535, scope: !0) !1 = !DILocalVariable(name: "foo", arg: 65535, scope: !0) Index: test/Assembler/dilocalvariable.ll =================================================================== --- test/Assembler/dilocalvariable.ll +++ test/Assembler/dilocalvariable.ll @@ -6,7 +6,7 @@ ; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} -!0 = distinct !DISubprogram() +!0 = distinct !DISubprogram(isDefinition: false) !1 = distinct !{} !2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir") !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) Index: test/Assembler/dilocation.ll =================================================================== --- test/Assembler/dilocation.ll +++ test/Assembler/dilocation.ll @@ -5,7 +5,7 @@ !named = !{!0, !1, !2, !3, !4, !5, !6, !7} ; CHECK: !0 = distinct !DISubprogram( -!0 = distinct !DISubprogram() +!0 = distinct !DISubprogram(isDefinition: false) ; CHECK-NEXT: !1 = !DILocation(line: 3, column: 7, scope: !0) !1 = !DILocation(line: 3, column: 7, scope: !0) Index: test/Assembler/disubprogram.ll =================================================================== --- test/Assembler/disubprogram.ll +++ test/Assembler/disubprogram.ll @@ -32,4 +32,7 @@ templateParams: !5, declaration: !8, variables: !6) !10 = !{i32 1, !"Debug Info Version", i32 3} +!11 = distinct !DICompileUnit(subprograms: !12, language: DW_LANG_C, file: !2) +!12 = !{!7, !9} !llvm.module.flags = !{!10} +!llvm.dbg.cu = !{!11} Index: test/Assembler/metadata.ll =================================================================== --- test/Assembler/metadata.ll +++ test/Assembler/metadata.ll @@ -30,7 +30,7 @@ } !0 = !DILocation(line: 662302, column: 26, scope: !1) -!1 = distinct !DISubprogram(name: "foo") +!1 = distinct !DISubprogram(name: "foo", isDefinition: false) !2 = distinct !{} !3 = distinct !{} !4 = distinct !{} Index: test/Bitcode/DILocalVariable-explicit-tags.ll =================================================================== --- test/Bitcode/DILocalVariable-explicit-tags.ll +++ test/Bitcode/DILocalVariable-explicit-tags.ll @@ -10,7 +10,7 @@ !named = !{!0} -!0 = distinct !DISubprogram(name: "foo", variables: !1) +!0 = distinct !DISubprogram(name: "foo", variables: !1, isDefinition: false) !1 = !{!2, !3} !2 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "param", arg: 1, scope: !0) !3 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "auto", scope: !0) Index: test/Bitcode/debug-loc-again.ll =================================================================== --- test/Bitcode/debug-loc-again.ll +++ test/Bitcode/debug-loc-again.ll @@ -27,6 +27,7 @@ ; CHECK: ![[LINE2]] = !DILocation(line: 2, !llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !DIFile(filename: "f", directory: "/d"), Index: test/BugPoint/metadata.ll =================================================================== --- test/BugPoint/metadata.ll +++ test/BugPoint/metadata.ll @@ -31,7 +31,7 @@ !3 = !{!"noise"} !4 = !{!"filler"} -!9 = distinct !DISubprogram(name: "test", file: !15) +!9 = distinct !DISubprogram(name: "test", file: !15, isDefinition: false) !10 = !DILocation(line: 100, column: 101, scope: !9) !11 = !DILocation(line: 102, column: 103, scope: !9) !12 = !DILocation(line: 104, column: 105, scope: !9) Index: test/CodeGen/MIR/X86/invalid-metadata-node-type.mir =================================================================== --- test/CodeGen/MIR/X86/invalid-metadata-node-type.mir +++ test/CodeGen/MIR/X86/invalid-metadata-node-type.mir @@ -22,7 +22,7 @@ !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3} - !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: 0, enums: !2, retainedTypes: !2) + !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: 0, enums: !2, retainedTypes: !2, subprograms: !9) !1 = !DIFile(filename: "t.c", directory: "") !2 = !{} !3 = !{i32 1, !"Debug Info Version", i32 3} @@ -31,6 +31,7 @@ !6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) !7 = !DIExpression() !8 = !DILocation(line: 0, scope: !5) + !9 = !{!5} ... --- name: foo Index: test/CodeGen/MIR/X86/stack-object-debug-info.mir =================================================================== --- test/CodeGen/MIR/X86/stack-object-debug-info.mir +++ test/CodeGen/MIR/X86/stack-object-debug-info.mir @@ -31,7 +31,7 @@ !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3} - !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: 0, enums: !2, retainedTypes: !2) + !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: 0, enums: !2, retainedTypes: !2, subprograms: !{!5}) !1 = !DIFile(filename: "t.c", directory: "") !2 = !{} !3 = !{i32 1, !"Debug Info Version", i32 3} @@ -51,9 +51,12 @@ frameInfo: maxAlignment: 16 # CHECK-LABEL: foo +# CHECK: ![[DIVARIABLE:[0-9]+]] = !DILocalVariable(name: "x" +# CHECK: ![[DIEXPRESSION:[0-9]+]] = !DIExpression() +# CHECK: ![[DILOCATION:[0-9]+]] = !DILocation(line: 0, # CHECK: stack: -# CHECK: - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4', -# CHECK-NEXT: di-expression: '!10', di-location: '!11' } +# CHECK: - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '![[DIVARIABLE]]', +# CHECK-NEXT: di-expression: '![[DIEXPRESSION]]', di-location: '![[DILOCATION]]' } stack: - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4', di-expression: '!7', di-location: '!8' } Index: test/CodeGen/Thumb/2010-07-15-debugOrdering.ll =================================================================== --- test/CodeGen/Thumb/2010-07-15-debugOrdering.ll +++ test/CodeGen/Thumb/2010-07-15-debugOrdering.ll @@ -151,5 +151,5 @@ !98 = !DILocation(line: 52, scope: !1) !101 = !DIFile(filename: "ggEdgeDiscrepancy.cc", directory: "/Volumes/Home/grosbaj/sources/llvm-externals/speccpu2000/benchspec/CINT2000/252.eon/src") !102 = !{} -!103 = !{!3, !77} +!103 = !{!3, !77, !37, !41, !42} !104 = !{i32 1, !"Debug Info Version", i32 3} Index: test/CodeGen/X86/StackColoring-dbg.ll =================================================================== --- test/CodeGen/X86/StackColoring-dbg.ll +++ test/CodeGen/X86/StackColoring-dbg.ll @@ -27,7 +27,7 @@ !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!23} -!0 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "clang", isOptimized: true, emissionKind: 0, file: !1, enums: !{}, retainedTypes: !{}) +!0 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "clang", isOptimized: true, emissionKind: 0, file: !1, enums: !{}, retainedTypes: !{}, subprograms: !{!2}) !1 = !DIFile(filename: "t.c", directory: "") !16 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) !2 = distinct !DISubprogram() Index: test/CodeGen/X86/machine-trace-metrics-crash.ll =================================================================== --- test/CodeGen/X86/machine-trace-metrics-crash.ll +++ test/CodeGen/X86/machine-trace-metrics-crash.ll @@ -51,7 +51,7 @@ !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!2} -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: 1) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: 1, subprograms: !{!3}) !1 = !DIFile(filename: "24199.cpp", directory: "/bin") !2 = !{i32 2, !"Debug Info Version", i32 3} !3 = distinct !DISubprogram(linkageName: "foo", file: !1, line: 18, isLocal: false, isDefinition: true, scopeLine: 18) Index: test/DebugInfo/Generic/2010-03-19-DbgDeclare.ll =================================================================== --- test/DebugInfo/Generic/2010-03-19-DbgDeclare.ll +++ test/DebugInfo/Generic/2010-03-19-DbgDeclare.ll @@ -9,7 +9,7 @@ } !llvm.dbg.cu = !{!2} !llvm.module.flags = !{!5} -!2 = distinct !DICompileUnit(language: DW_LANG_Mips_Assembler, producer: "clang version 3.3 ", isOptimized: false, emissionKind: 1, file: !4, enums: !3, retainedTypes: !3, subprograms: !3, globals: !3, imports: !3) +!2 = distinct !DICompileUnit(language: DW_LANG_Mips_Assembler, producer: "clang version 3.3 ", isOptimized: false, emissionKind: 1, file: !4, enums: !3, retainedTypes: !3, subprograms: !{!6}, globals: !3, imports: !3) !3 = !{} !0 = !DILocation(line: 662302, column: 26, scope: !1) !1 = !DILocalVariable(name: "foo", scope: !6) Index: test/DebugInfo/Generic/2010-07-19-Crash.ll =================================================================== --- test/DebugInfo/Generic/2010-07-19-Crash.ll +++ test/DebugInfo/Generic/2010-07-19-Crash.ll @@ -25,6 +25,6 @@ !10 = distinct !DILexicalBlock(line: 3, column: 11, file: !12, scope: !0) !11 = !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: true, isDefinition: false, virtualIndex: 6, isOptimized: true, file: !12, scope: !1, type: !3) !12 = !DIFile(filename: "one.c", directory: "/private/tmp") -!13 = !{!0} +!13 = !{!0, !6} !14 = !{} !15 = !{i32 1, !"Debug Info Version", i32 3} Index: test/Instrumentation/ThreadSanitizer/atomic.ll =================================================================== --- test/Instrumentation/ThreadSanitizer/atomic.ll +++ test/Instrumentation/ThreadSanitizer/atomic.ll @@ -1994,5 +1994,5 @@ !3 = !{} !4 = !DISubroutineType(types: !3) !5 = !DIFile(filename: "atomic.cpp", directory: "/tmp") -!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !3) +!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: false, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !3) !7 = !DILocation(line: 100, column: 1, scope: !6) Index: test/Linker/Inputs/mdlocation.ll =================================================================== --- test/Linker/Inputs/mdlocation.ll +++ test/Linker/Inputs/mdlocation.ll @@ -1,6 +1,6 @@ !named = !{!0, !1, !2, !3, !4, !5} -!0 = distinct !DISubprogram() ; Use this as a scope. +!0 = distinct !DISubprogram(isDefinition: false) ; Use this as a scope. !1 = !DILocation(line: 3, column: 7, scope: !0) !2 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !1) !3 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !2) Index: test/Linker/mdlocation.ll =================================================================== --- test/Linker/mdlocation.ll +++ test/Linker/mdlocation.ll @@ -17,7 +17,7 @@ ; CHECK-NEXT: !9 = !DILocation(line: 3, column: 7, scope: !6, inlinedAt: !8) ; CHECK-NEXT: !10 = distinct !DILocation(line: 3, column: 7, scope: !6) ; CHECK-NEXT: !11 = distinct !DILocation(line: 3, column: 7, scope: !6, inlinedAt: !10) -!0 = distinct !DISubprogram() ; Use this as a scope. +!0 = distinct !DISubprogram(isDefinition: false) ; Use this as a scope. !1 = !DILocation(line: 3, column: 7, scope: !0) !2 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !1) !3 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !2) Index: test/Transforms/AddDiscriminators/basic.ll =================================================================== --- test/Transforms/AddDiscriminators/basic.ll +++ test/Transforms/AddDiscriminators/basic.ll @@ -49,7 +49,7 @@ !1 = !DIFile(filename: "basic.c", directory: ".") !2 = !{} !3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) +!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) !5 = !DIFile(filename: "basic.c", directory: ".") !6 = !DISubroutineType(types: !2) !7 = !{i32 2, !"Dwarf Version", i32 4} Index: test/Transforms/AddDiscriminators/call.ll =================================================================== --- test/Transforms/AddDiscriminators/call.ll +++ test/Transforms/AddDiscriminators/call.ll @@ -35,7 +35,7 @@ !1 = !DIFile(filename: "c.cc", directory: "/tmp") !2 = !{} !3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, variables: !2) +!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, variables: !2) !5 = !DISubroutineType(types: !6) !6 = !{null} !7 = !{i32 2, !"Dwarf Version", i32 4} Index: test/Transforms/AddDiscriminators/dbg-declare-discriminator.ll =================================================================== --- test/Transforms/AddDiscriminators/dbg-declare-discriminator.ll +++ test/Transforms/AddDiscriminators/dbg-declare-discriminator.ll @@ -19,12 +19,12 @@ !0 = !{i32 2, !"Dwarf Version", i32 4} !1 = !{i32 2, !"Debug Info Version", i32 3} !2 = !DILocalVariable(scope: !3) -!3 = distinct !DISubprogram(scope: null, file: !4, isLocal: false, isDefinition: true, isOptimized: false) +!3 = distinct !DISubprogram(scope: null, file: !4, isLocal: false, isDefinition: false, isOptimized: false) !4 = !DIFile(filename: "a.cpp", directory: "/tmp") !5 = !DIExpression() !6 = !DILocation(line: 0, scope: !3, inlinedAt: !7) !7 = distinct !DILocation(line: 0, scope: !8) -!8 = distinct !DISubprogram(linkageName: "test_valid_metadata", scope: null, isLocal: false, isDefinition: true, isOptimized: false) +!8 = distinct !DISubprogram(linkageName: "test_valid_metadata", scope: null, isLocal: false, isDefinition: false, isOptimized: false) !9 = !DILocalVariable(scope: !10) -!10 = distinct !DISubprogram(scope: null, file: !4, isLocal: false, isDefinition: true, isOptimized: false) +!10 = distinct !DISubprogram(scope: null, file: !4, isLocal: false, isDefinition: false, isOptimized: false) !11 = !DILocation(line: 0, scope: !10) Index: test/Transforms/AddDiscriminators/first-only.ll =================================================================== --- test/Transforms/AddDiscriminators/first-only.ll +++ test/Transforms/AddDiscriminators/first-only.ll @@ -58,7 +58,7 @@ !1 = !DIFile(filename: "first-only.c", directory: ".") !2 = !{} !3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) +!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) !5 = !DIFile(filename: "first-only.c", directory: ".") !6 = !DISubroutineType(types: !{null}) !7 = !{i32 2, !"Dwarf Version", i32 4} Index: test/Transforms/AddDiscriminators/multiple.ll =================================================================== --- test/Transforms/AddDiscriminators/multiple.ll +++ test/Transforms/AddDiscriminators/multiple.ll @@ -59,7 +59,7 @@ !1 = !DIFile(filename: "multiple.c", directory: ".") !2 = !{} !3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) +!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) !5 = !DIFile(filename: "multiple.c", directory: ".") !6 = !DISubroutineType(types: !{null, !13}) !13 = !DIBasicType(encoding: DW_ATE_signed, name: "int", size: 32, align: 32) Index: test/Transforms/AddDiscriminators/oneline.ll =================================================================== --- test/Transforms/AddDiscriminators/oneline.ll +++ test/Transforms/AddDiscriminators/oneline.ll @@ -66,7 +66,7 @@ !1 = !DIFile(filename: "a.cc", directory: "/usr/local/google/home/dehao/discr") !2 = !{} !3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !8) +!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: false, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !8) !5 = !DISubroutineType(types: !6) !6 = !{!7, !7} !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) Index: test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll =================================================================== --- test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll +++ test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll @@ -48,7 +48,7 @@ !0 = !DILocalVariable(name: "name", line: 8, arg: 1, scope: !1, file: !2, type: !6) !1 = distinct !DISubprogram(name: "vfs_addname", linkageName: "vfs_addname", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !28, scope: !2, type: !4) !2 = !DIFile(filename: "tail.c", directory: "/Users/echeng/LLVM/radars/r7927803/") -!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build 9999)", isOptimized: true, emissionKind: 0, file: !28, enums: !29, retainedTypes: !29) +!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build 9999)", isOptimized: true, emissionKind: 0, file: !28, enums: !29, retainedTypes: !29, subprograms: !{!1, !16}) !4 = !DISubroutineType(types: !5) !5 = !{!6, !6, !9, !9, !9} !6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !28, scope: !2, baseType: !7) Index: test/Transforms/GVN/load-pre-nonlocal.ll =================================================================== --- test/Transforms/GVN/load-pre-nonlocal.ll +++ test/Transforms/GVN/load-pre-nonlocal.ll @@ -99,7 +99,7 @@ !10 = !{} !11 = !DISubroutineType(types: !10) !12 = !DIFile(filename: "test.cpp", directory: "/tmp") -!13 = distinct !DISubprogram(name: "test", scope: !12, file: !12, line: 99, type: !11, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !10) +!13 = distinct !DISubprogram(name: "test", scope: !12, file: !12, line: 99, type: !11, isLocal: false, isDefinition: false, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !10) !14 = !DILocation(line: 100, column: 1, scope: !13) !15 = !DILocation(line: 101, column: 1, scope: !13) !16 = !DILocation(line: 102, column: 1, scope: !13) Index: test/Transforms/GVN/phi-translate.ll =================================================================== --- test/Transforms/GVN/phi-translate.ll +++ test/Transforms/GVN/phi-translate.ll @@ -44,7 +44,7 @@ !3 = !{} !4 = !DISubroutineType(types: !3) !5 = !DIFile(filename: "a.cc", directory: "/tmp") -!6 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 42, type: !4, isLocal: false, isDefinition: true, scopeLine: 43, flags: DIFlagPrototyped, isOptimized: false, variables: !3) +!6 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 42, type: !4, isLocal: false, isDefinition: false, scopeLine: 43, flags: DIFlagPrototyped, isOptimized: false, variables: !3) !7 = !DILocation(line: 43, column: 1, scope: !6) !8 = !DILocation(line: 44, column: 1, scope: !6) !9 = !DILocation(line: 45, column: 1, scope: !6) Index: test/Transforms/Inline/debug-invoke.ll =================================================================== --- test/Transforms/Inline/debug-invoke.ll +++ test/Transforms/Inline/debug-invoke.ll @@ -32,6 +32,6 @@ !llvm.module.flags = !{!1} !1 = !{i32 2, !"Debug Info Version", i32 3} -!2 = distinct !DISubprogram() +!2 = distinct !DISubprogram(isDefinition: false) !3 = !DILocation(line: 1, scope: !2) !4 = !DILocation(line: 2, scope: !2) Index: test/Transforms/LICM/debug-value.ll =================================================================== --- test/Transforms/LICM/debug-value.ll +++ test/Transforms/LICM/debug-value.ll @@ -34,7 +34,7 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone !llvm.module.flags = !{!26} -!llvm.dbg.sp = !{!0, !6, !9, !10} +!llvm.dbg.cu = !{!27} !0 = distinct !DISubprogram(name: "idamax", line: 112, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !25, scope: !1, type: !3) !1 = !DIFile(filename: "/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/Benchmarks/CoyoteBench/lpbench.c", directory: "/private/tmp") @@ -63,3 +63,5 @@ !24 = !DILocation(line: 313, column: 1, scope: !14) !25 = !DIFile(filename: "/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/Benchmarks/CoyoteBench/lpbench.c", directory: "/private/tmp") !26 = !{i32 1, !"Debug Info Version", i32 3} +!27 = distinct !DICompileUnit(subprograms: !28, language: DW_LANG_C, file: !1) +!28 = !{!0, !6, !9, !10} Index: test/Transforms/LoopIdiom/debug-line.ll =================================================================== --- test/Transforms/LoopIdiom/debug-line.ll +++ test/Transforms/LoopIdiom/debug-line.ll @@ -28,11 +28,11 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone !llvm.module.flags = !{!19} -!llvm.dbg.sp = !{!0} +!llvm.dbg.cu = !{!2} !0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !18, scope: !1, type: !3) !1 = !DIFile(filename: "li.c", directory: "/private/tmp") -!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 127165:127174)", isOptimized: true, emissionKind: 0, file: !18, enums: !9, retainedTypes: !9) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 127165:127174)", isOptimized: true, emissionKind: 0, file: !18, enums: !9, retainedTypes: !9, subprograms: !{!0}) !3 = !DISubroutineType(types: !4) !4 = !{null} !5 = !DILocalVariable(name: "a", line: 2, arg: 1, scope: !0, file: !1, type: !6) Index: test/Transforms/LoopRotate/dbgvalue.ll =================================================================== --- test/Transforms/LoopRotate/dbgvalue.ll +++ test/Transforms/LoopRotate/dbgvalue.ll @@ -84,7 +84,7 @@ !llvm.module.flags = !{!20} !llvm.dbg.sp = !{!0} -!0 = distinct !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !18, scope: !1, type: !3) +!0 = distinct !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !18, scope: !1, type: !3) !1 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame") !2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 125492)", isOptimized: true, emissionKind: 0, file: !18, enums: !19, retainedTypes: !19) !3 = !DISubroutineType(types: !4) Index: test/Transforms/LoopSimplify/dbg-loc.ll =================================================================== --- test/Transforms/LoopSimplify/dbg-loc.ll +++ test/Transforms/LoopSimplify/dbg-loc.ll @@ -80,7 +80,7 @@ !3 = !{} !4 = !DISubroutineType(types: !3) !5 = !DIFile(filename: "Vector.h", directory: "/tmp") -!6 = distinct !DISubprogram(name: "destruct", scope: !5, file: !5, line: 71, type: !4, isLocal: false, isDefinition: true, scopeLine: 72, flags: DIFlagPrototyped, isOptimized: false, variables: !3) +!6 = distinct !DISubprogram(name: "destruct", scope: !5, file: !5, line: 71, type: !4, isLocal: false, isDefinition: false, scopeLine: 72, flags: DIFlagPrototyped, isOptimized: false, variables: !3) !7 = !DILocation(line: 73, column: 38, scope: !6) !8 = !DILocation(line: 73, column: 13, scope: !6) !9 = !DILocation(line: 73, column: 27, scope: !6) Index: test/Transforms/LoopSimplify/single-backedge.ll =================================================================== --- test/Transforms/LoopSimplify/single-backedge.ll +++ test/Transforms/LoopSimplify/single-backedge.ll @@ -30,7 +30,7 @@ !2 = !{} !3 = !DISubroutineType(types: !2) !4 = !DIFile(filename: "atomic.cpp", directory: "/tmp") -!5 = distinct !DISubprogram(name: "test", scope: !4, file: !4, line: 99, type: !3, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !2) +!5 = distinct !DISubprogram(name: "test", scope: !4, file: !4, line: 99, type: !3, isLocal: false, isDefinition: false, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !2) !6 = !DILocation(line: 100, column: 1, scope: !5) !7 = !DILocation(line: 101, column: 1, scope: !5) !8 = !DILocation(line: 102, column: 1, scope: !5) Index: test/Transforms/LoopUnroll/runtime-loop1.ll =================================================================== --- test/Transforms/LoopUnroll/runtime-loop1.ll +++ test/Transforms/LoopUnroll/runtime-loop1.ll @@ -44,7 +44,7 @@ !3 = !{} !4 = !DISubroutineType(types: !3) !5 = !DIFile(filename: "test.cpp", directory: "/tmp") -!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !3) +!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: false, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !3) !7 = !DILocation(line: 100, column: 1, scope: !6) !8 = !DILocation(line: 101, column: 1, scope: !6) !9 = !DILocation(line: 102, column: 1, scope: !6) Index: test/Transforms/LoopVectorize/X86/no_fpmath.ll =================================================================== --- test/Transforms/LoopVectorize/X86/no_fpmath.ll +++ test/Transforms/LoopVectorize/X86/no_fpmath.ll @@ -78,7 +78,7 @@ !1 = !{i32 1, !"PIC Level", i32 2} !2 = !{!"clang version 3.7.0"} !3 = !DILocation(line: 5, column: 20, scope: !4) -!4 = distinct !DISubprogram(name: "cond_sum", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !7) +!4 = distinct !DISubprogram(name: "cond_sum", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: false, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !7) !5 = !DIFile(filename: "no_fpmath.c", directory: "") !6 = !DISubroutineType(types: !7) !7 = !{} @@ -94,7 +94,7 @@ !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.unroll.disable"} !19 = !DILocation(line: 16, column: 20, scope: !20) -!20 = distinct !DISubprogram(name: "cond_sum_loop_hint", scope: !5, file: !5, line: 12, type: !6, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, variables: !7) +!20 = distinct !DISubprogram(name: "cond_sum_loop_hint", scope: !5, file: !5, line: 12, type: !6, isLocal: false, isDefinition: false, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, variables: !7) !21 = !DILocation(line: 16, column: 3, scope: !20) !22 = !DILocation(line: 17, column: 14, scope: !20) !23 = !DILocation(line: 20, column: 3, scope: !20) Index: test/Transforms/LoopVectorize/X86/vectorization-remarks.ll =================================================================== --- test/Transforms/LoopVectorize/X86/vectorization-remarks.ll +++ test/Transforms/LoopVectorize/X86/vectorization-remarks.ll @@ -52,7 +52,7 @@ !1 = !DIFile(filename: "vectorization-remarks.c", directory: ".") !2 = !{} !3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !1, scope: !5, type: !6, variables: !2) +!4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !1, scope: !5, type: !6, variables: !2) !5 = !DIFile(filename: "vectorization-remarks.c", directory: ".") !6 = !DISubroutineType(types: !2) !7 = !{i32 2, !"Dwarf Version", i32 4} Index: test/Transforms/LoopVectorize/runtime-check.ll =================================================================== --- test/Transforms/LoopVectorize/runtime-check.ll +++ test/Transforms/LoopVectorize/runtime-check.ll @@ -73,7 +73,7 @@ !2 = !{} !3 = !DISubroutineType(types: !2) !4 = !DIFile(filename: "test.cpp", directory: "/tmp") -!5 = distinct !DISubprogram(name: "foo", scope: !4, file: !4, line: 99, type: !3, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !2) +!5 = distinct !DISubprogram(name: "foo", scope: !4, file: !4, line: 99, type: !3, isLocal: false, isDefinition: false, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !2) !6 = !DILocation(line: 100, column: 1, scope: !5) !7 = !DILocation(line: 101, column: 1, scope: !5) !8 = !DILocation(line: 102, column: 1, scope: !5) Index: test/Transforms/Mem2Reg/ConvertDebugInfo2.ll =================================================================== --- test/Transforms/Mem2Reg/ConvertDebugInfo2.ll +++ test/Transforms/Mem2Reg/ConvertDebugInfo2.ll @@ -45,7 +45,7 @@ !0 = !DILocalVariable(name: "a", line: 8, arg: 1, scope: !1, file: !2, type: !6) !1 = distinct !DISubprogram(name: "baz", linkageName: "baz", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 8, file: !20, scope: !2, type: !4) !2 = !DIFile(filename: "bar.c", directory: "/tmp/") -!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 0, file: !20, enums: !21, retainedTypes: !21, subprograms: !{!1}) +!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 0, file: !20, enums: !21, retainedTypes: !21, subprograms: !{!1,!10}) !4 = !DISubroutineType(types: !5) !5 = !{null, !6} !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) Index: test/Transforms/ObjCARC/basic.ll =================================================================== --- test/Transforms/ObjCARC/basic.ll +++ test/Transforms/ObjCARC/basic.ll @@ -3018,7 +3018,7 @@ !0 = !{} !1 = !{i32 1, !"Debug Info Version", i32 3} -!2 = distinct !DISubprogram() +!2 = distinct !DISubprogram(isDefinition: false) ; CHECK: attributes #0 = { nounwind readnone } ; CHECK: attributes [[NUW]] = { nounwind } Index: test/Transforms/SROA/dbg-single-piece.ll =================================================================== --- test/Transforms/SROA/dbg-single-piece.ll +++ test/Transforms/SROA/dbg-single-piece.ll @@ -11,7 +11,7 @@ ; Checks that SROA still inserts a bit_piece expression, even if it produces only one piece ; (as long as that piece is smaller than the whole thing) ; CHECK-NOT: call void @llvm.dbg.value -; CHECK: call void @llvm.dbg.value(metadata %foo* undef, i64 0, metadata !1, metadata ![[BIT_PIECE:[0-9]+]]), !dbg +; CHECK: call void @llvm.dbg.value(metadata %foo* undef, i64 0, metadata ![[VAR:[0-9]+]], metadata ![[BIT_PIECE:[0-9]+]]), !dbg ; CHECK-NOT: call void @llvm.dbg.value ; CHECK: ![[BIT_PIECE]] = !DIExpression(DW_OP_bit_piece, 64, 64) %0 = bitcast %foo* %retval to i8* @@ -23,7 +23,7 @@ attributes #0 = { nounwind readnone } -!llvm.dbg.cu = !{} +!llvm.dbg.cu = !{!9} !llvm.module.flags = !{!0} !0 = !{i32 2, !"Debug Info Version", i32 3} @@ -35,3 +35,5 @@ !6 = !{} !7 = !DIExpression() !8 = !DILocation(line: 947, column: 35, scope: !2) +!9 = distinct !DICompileUnit(subprograms: !10, file: !3, language: DW_LANG_C_plus_plus) +!10 = !{!2} Index: test/Transforms/SampleProfile/calls.ll =================================================================== --- test/Transforms/SampleProfile/calls.ll +++ test/Transforms/SampleProfile/calls.ll @@ -91,6 +91,7 @@ !llvm.module.flags = !{!8, !9} !llvm.ident = !{!10} +!llvm.dbg.cu = !{!0} !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) !1 = !DIFile(filename: "calls.cc", directory: ".") Index: test/Transforms/SampleProfile/fnptr.ll =================================================================== --- test/Transforms/SampleProfile/fnptr.ll +++ test/Transforms/SampleProfile/fnptr.ll @@ -126,6 +126,7 @@ !llvm.module.flags = !{!0} !llvm.ident = !{!1} +!llvm.dbg.cu = !{!26} !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = !{!"clang version 3.6.0 "} @@ -153,3 +154,5 @@ !23 = !{!"branch_weights", i32 0, i32 534} !24 = !DILocation(line: 27, column: 3, scope: !13) !25 = !DILocation(line: 28, column: 3, scope: !13) +!26 = distinct !DICompileUnit(subprograms: !27, file: !4, language: DW_LANG_C_plus_plus) +!27 = !{!3, !10, !13} Index: test/Transforms/SampleProfile/inline-hint.ll =================================================================== --- test/Transforms/SampleProfile/inline-hint.ll +++ test/Transforms/SampleProfile/inline-hint.ll @@ -14,6 +14,7 @@ !llvm.module.flags = !{!17, !18} !llvm.ident = !{!19} +!llvm.dbg.cu = !{!40} !1 = !DIFile(filename: "inline-hint.cc", directory: ".") !2 = !{} @@ -36,3 +37,5 @@ !19 = !{!"clang version 3.8.0 (trunk 254067) (llvm/trunk 254079)"} !29 = !DILocation(line: 5, column: 1, scope: !4) !38 = !DILocation(line: 9, column: 1, scope: !10) +!40 = distinct !DICompileUnit(subprograms: !41, file: !1, language: DW_LANG_C_plus_plus) +!41 = !{!4, !10, !11, !14} Index: test/Transforms/SampleProfile/inline.ll =================================================================== --- test/Transforms/SampleProfile/inline.ll +++ test/Transforms/SampleProfile/inline.ll @@ -79,6 +79,7 @@ !llvm.module.flags = !{!8, !9} !llvm.ident = !{!10} +!llvm.dbg.cu = !{!0} !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) !1 = !DIFile(filename: "calls.cc", directory: ".") Index: test/Transforms/SimplifyCFG/basictest.ll =================================================================== --- test/Transforms/SimplifyCFG/basictest.ll +++ test/Transforms/SimplifyCFG/basictest.ll @@ -75,10 +75,11 @@ !0 = !{!1, !1, i64 0} !1 = !{!"foo"} !2 = !{i8 0, i8 2} -!3 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !4, subprograms: !4, globals: !4) +!3 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !10, subprograms: !{!6}, globals: !4) !4 = !{} !5 = !DILocation(line: 23, scope: !6) !6 = distinct !DISubprogram(name: "foo", scope: !3, file: !7, line: 1, type: !DISubroutineType(types: !4), isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, variables: !4) !7 = !DIFile(filename: "foo.c", directory: "/") !8 = !{i32 2, !"Dwarf Version", i32 2} !9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !{} Index: test/Transforms/SimplifyCFG/hoist-dbgvalue.ll =================================================================== --- test/Transforms/SimplifyCFG/hoist-dbgvalue.ll +++ test/Transforms/SimplifyCFG/hoist-dbgvalue.ll @@ -30,17 +30,17 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone !llvm.module.flags = !{!21} -!llvm.dbg.sp = !{!0} +!llvm.dbg.cu = !{!2} !0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !20, scope: !1, type: !3) !1 = !DIFile(filename: "b.c", directory: "/private/tmp") -!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !20, enums: !8, retainedTypes: !8) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !20, enums: !8, retainedTypes: !8, subprograms: !22) !3 = !DISubroutineType(types: !4) !4 = !{!5} !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !6 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !0, file: !1, type: !5) !7 = !DILocation(line: 2, column: 13, scope: !0) -!8 = !{i32 0} +!8 = !{} !9 = !DILocalVariable(name: "k", line: 3, scope: !10, file: !1, type: !5) !10 = distinct !DILexicalBlock(line: 2, column: 16, file: !20, scope: !0) !11 = !DILocation(line: 3, column: 12, scope: !10) @@ -54,3 +54,4 @@ !19 = !DILocation(line: 9, column: 3, scope: !10) !20 = !DIFile(filename: "b.c", directory: "/private/tmp") !21 = !{i32 1, !"Debug Info Version", i32 3} +!22 = !{!0} Index: test/Transforms/Util/simplify-dbg-declare-load.ll =================================================================== --- test/Transforms/Util/simplify-dbg-declare-load.ll +++ test/Transforms/Util/simplify-dbg-declare-load.ll @@ -19,9 +19,9 @@ unreachable idxend: ; preds = %top -; CHECK-NOT call void @llvm.dbg.value(metadata %foo* %cp, i64 0, metadata !1, metadata !16), !dbg !17 +; CHECK-NOT call void @llvm.dbg.value(metadata %foo* %cp %0 = load volatile %foo, %foo* %cp, align 8 -; CHECK: call void @llvm.dbg.value(metadata %foo %0, i64 0, metadata !1, metadata !16), !dbg !17 +; CHECK: call void @llvm.dbg.value(metadata %foo %0, i64 0, metadata !{{[0-9]+}}, metadata !{{[0-9]+}}), !dbg !{{[0-9]+}} store volatile %foo %0, %foo* undef, align 8 ret void } @@ -30,7 +30,7 @@ attributes #1 = { sspreq } !llvm.module.flags = !{!0} -!llvm.dbg.cu = !{} +!llvm.dbg.cu = !{!18} !0 = !{i32 1, !"Debug Info Version", i32 3} !1 = !DILocalVariable(name: "cp", scope: !2, file: !3, line: 106, type: !12) @@ -50,3 +50,5 @@ !15 = !DIBasicType(name: "Int32", size: 32, align: 32, encoding: DW_ATE_unsigned) !16 = !DIExpression() !17 = !DILocation(line: 106, scope: !2) +!18 = distinct !DICompileUnit(subprograms: !19, file: !3, language: DW_LANG_Julia) +!19 = !{!2} Index: test/Transforms/Util/split-bit-piece.ll =================================================================== --- test/Transforms/Util/split-bit-piece.ll +++ test/Transforms/Util/split-bit-piece.ll @@ -29,7 +29,7 @@ !llvm.module.flags = !{!7} !llvm.ident = !{!8} -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 256979) (llvm/trunk 257107)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, retainedTypes: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 256979) (llvm/trunk 257107)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, retainedTypes: !2, subprograms: !14) !1 = !DIFile(filename: "tsan_shadow_test.cc", directory: "/tmp") !2 = !{!3, !5} !3 = !DICompositeType(tag: DW_TAG_class_type, name: "FastState", file: !4, line: 91, size: 64, align: 64, identifier: "_ZTSN6__tsan9FastStateE") @@ -43,3 +43,4 @@ !11 = distinct !DISubprogram(name: "SetHistorySize", linkageName: "_ZN6__tsan9FastState14SetHistorySizeEi", scope: !"_ZTSN6__tsan9FastStateE", file: !4, line: 135, isLocal: false, isDefinition: true, scopeLine: 135, flags: DIFlagPrototyped, isOptimized: false) !12 = !DIExpression() !13 = !DILocation(line: 136, column: 5, scope: !10) +!14 = !{!11} Index: test/Transforms/Util/store-first-op.ll =================================================================== --- test/Transforms/Util/store-first-op.ll +++ test/Transforms/Util/store-first-op.ll @@ -24,7 +24,7 @@ !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!2} -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257597)", isOptimized: true, runtimeVersion: 0, emissionKind: 1) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257597)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, subprograms: !10) !1 = !DIFile(filename: "none", directory: ".") !2 = !{i32 2, !"Debug Info Version", i32 3} !3 = !DILocalVariable(name: "getU", scope: !4, file: !1, line: 25, type: !5) @@ -34,3 +34,4 @@ !7 = !DILocation(line: 25, column: 8, scope: !4) !8 = !{!9, !9, i64 0} !9 = !{i64 0} +!10 = !{!4}