From: Adrian Prantl Date: Wed, 5 Oct 2016 22:15:34 +0000 (+0000) Subject: Revert "Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace." X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f1ad48020b0e295972efb6c6d24c4a3cdf71300;p=llvm Revert "Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace." Forgot to add a testcase in r283390. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283399 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 7eea5170b94..980cb7746ec 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -698,15 +698,10 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) { } void Verifier::visitNamedMDNode(const NamedMDNode &NMD) { - // There used to be various other llvm.dbg.* nodes, but we don't support - // upgrading them and we want to reserve the namespace for future uses. - if (NMD.getName().startswith("llvm.dbg.")) - AssertDI(NMD.getName() == "llvm.dbg.cu", - "unrecognized named metadata node in the llvm.dbg namespace", - &NMD); for (const MDNode *MD : NMD.operands()) { - if (NMD.getName() == "llvm.dbg.cu") + if (NMD.getName() == "llvm.dbg.cu") { AssertDI(MD && isa(MD), "invalid compile unit", &NMD, MD); + } if (!MD) continue; diff --git a/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll b/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll index 4b019abf5d5..fa3932d2669 100644 --- a/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll +++ b/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll @@ -3,49 +3,57 @@ ; Test to check that unused argument 'this' is not undefined in debug info. target triple = "x86_64-apple-darwin10.2" - %struct.foo = type { i32 } -@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.foo*, i32)* @_ZN3foo3bazEi to i8*)], section "llvm.metadata" +@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.foo*, i32)* @_ZN3foo3bazEi to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] -; Function Attrs: noinline nounwind optsize readnone ssp -define i32 @_ZN3foo3bazEi(%struct.foo* nocapture %this, i32 %x) #0 align 2 !dbg !4 { -entry: - ; CHECK: DEBUG_VALUE: baz:this <- %RDI{{$}} - tail call void @llvm.dbg.value(metadata %struct.foo* %this, i64 0, metadata !13, metadata !16), !dbg !17 - tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !18, metadata !16), !dbg !17 - %0 = mul nsw i32 %x, 7, !dbg !19 - %1 = add nsw i32 %0, 1, !dbg !19 - ret i32 %1, !dbg !19 +define i32 @_ZN3foo3bazEi(%struct.foo* nocapture %this, i32 %x) nounwind readnone optsize noinline ssp align 2 !dbg !8 { +;CHECK: DEBUG_VALUE: baz:this <- %RDI{{$}} +entry: + tail call void @llvm.dbg.value(metadata %struct.foo* %this, i64 0, metadata !15, metadata !DIExpression()), !dbg !DILocation(scope: !8) + tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !16, metadata !DIExpression()), !dbg !DILocation(scope: !8) + %0 = mul nsw i32 %x, 7, !dbg !29 ; [#uses=1] + %1 = add nsw i32 %0, 1, !dbg !29 ; [#uses=1] + ret i32 %1, !dbg !29 } -; Function Attrs: nounwind readnone -declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 - -attributes #0 = { noinline nounwind optsize readnone ssp } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "4.2.1 LLVM build", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2) -!1 = !DIFile(filename: "foo.cp", directory: "/tmp/") -!2 = !{} -!3 = !{i32 1, !"Debug Info Version", i32 3} -!4 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3foo3bazEi", scope: !5, file: !1, line: 15, type: !10, isLocal: false, isDefinition: true, scopeLine: 15, virtualIndex: 6, isOptimized: true, unit: !0) -!5 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", scope: !1, file: !1, line: 3, size: 32, align: 32, elements: !6) -!6 = !{!7, !9, !4} -!7 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !5, file: !1, line: 8, baseType: !8, size: 32, align: 32) -!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!9 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEi", scope: !5, file: !1, line: 11, type: !10, isLocal: false, isDefinition: true, scopeLine: 11, virtualIndex: 6, isOptimized: true, unit: !0) -!10 = !DISubroutineType(types: !11) -!11 = !{!8, !12, !8} -!12 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !1, file: !1, baseType: !5, size: 64, align: 64, flags: DIFlagArtificial) -!13 = !DILocalVariable(name: "this", arg: 1, scope: !4, file: !1, line: 15, type: !14) -!14 = !DIDerivedType(tag: DW_TAG_const_type, scope: !1, file: !1, baseType: !15, size: 64, align: 64, flags: DIFlagArtificial) -!15 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !1, file: !1, baseType: !5, size: 64, align: 64) -!16 = !DIExpression() -!17 = !DILocation(line: 0, scope: !4) -!18 = !DILocalVariable(name: "x", arg: 2, scope: !4, file: !1, line: 15, type: !8) -!19 = !DILocation(line: 16, scope: !20) -!20 = distinct !DILexicalBlock(scope: !4, file: !1, line: 15) +declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone + +!llvm.dbg.cu = !{!4} +!llvm.module.flags = !{!34} +!llvm.dbg.lv = !{!0, !14, !15, !16, !17, !24, !25, !28} + +!0 = !DILocalVariable(name: "this", line: 11, arg: 1, scope: !1, file: !3, type: !12) +!1 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEi", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4, scopeLine: 11, file: !31, scope: !2, type: !9) +!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 3, size: 32, align: 32, file: !31, scope: !3, elements: !5) +!3 = !DIFile(filename: "foo.cp", directory: "/tmp/") +!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 LLVM build", isOptimized: true, emissionKind: FullDebug, file: !31, enums: !32, retainedTypes: !32) +!5 = !{!6, !1, !8} +!6 = !DIDerivedType(tag: DW_TAG_member, name: "y", line: 8, size: 32, align: 32, file: !31, scope: !2, baseType: !7) +!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3foo3bazEi", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4, scopeLine: 15, file: !31, scope: !2, type: !9) +!9 = !DISubroutineType(types: !10) +!10 = !{!7, !11, !7} +!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !31, scope: !3, baseType: !2) +!12 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !31, scope: !3, baseType: !13) +!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !2) +!14 = !DILocalVariable(name: "x", line: 11, arg: 2, scope: !1, file: !3, type: !7) +!15 = !DILocalVariable(name: "this", line: 15, arg: 1, scope: !8, file: !3, type: !12) +!16 = !DILocalVariable(name: "x", line: 15, arg: 2, scope: !8, file: !3, type: !7) +!17 = !DILocalVariable(name: "argc", line: 19, arg: 1, scope: !18, file: !3, type: !7) +!18 = distinct !DISubprogram(name: "main", linkageName: "main", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4, scopeLine: 19, file: !31, scope: !3, type: !19) +!19 = !DISubroutineType(types: !20) +!20 = !{!7, !7, !21} +!21 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !22) +!22 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !23) +!23 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) +!24 = !DILocalVariable(name: "argv", line: 19, arg: 2, scope: !18, file: !3, type: !21) +!25 = !DILocalVariable(name: "a", line: 20, scope: !26, file: !3, type: !2) +!26 = distinct !DILexicalBlock(line: 19, column: 0, file: !31, scope: !27) +!27 = distinct !DILexicalBlock(line: 19, column: 0, file: !31, scope: !18) +!28 = !DILocalVariable(name: "b", line: 21, scope: !26, file: !3, type: !7) +!29 = !DILocation(line: 16, scope: !30) +!30 = distinct !DILexicalBlock(line: 15, column: 0, file: !31, scope: !8) +!31 = !DIFile(filename: "foo.cp", directory: "/tmp/") +!32 = !{} +!34 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/test/DebugInfo/Generic/2010-07-19-Crash.ll b/test/DebugInfo/Generic/2010-07-19-Crash.ll new file mode 100644 index 00000000000..edf4dde5aa1 --- /dev/null +++ b/test/DebugInfo/Generic/2010-07-19-Crash.ll @@ -0,0 +1,28 @@ +; RUN: llc -o /dev/null < %s +; PR7662 +; Do not add variables to !11 because it is a declaration entry. + +define i32 @bar() nounwind readnone ssp !dbg !0 { +entry: + ret i32 42, !dbg !9 +} + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!15} +!llvm.dbg.lv.foo = !{!7} + +!0 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, file: !12, scope: !1, type: !3) +!1 = !DIFile(filename: "one.c", directory: "/private/tmp") +!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang 2.8", isOptimized: true, emissionKind: FullDebug, file: !12, enums: !14, retainedTypes: !14) +!3 = !DISubroutineType(types: !4) +!4 = !{!5} +!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!6 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, file: !12, scope: !1, type: !3, declaration: !11) +!7 = !DILocalVariable(name: "one", line: 8, scope: !8, file: !1, type: !5) +!8 = distinct !DILexicalBlock(line: 7, column: 18, file: !12, scope: !6) +!9 = !DILocation(line: 4, column: 3, scope: !10) +!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") +!14 = !{} +!15 = !{i32 1, !"Debug Info Version", i32 3}