mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-04 10:59:04 +00:00
Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace.
This came out of a discussion in https://reviews.llvm.org/D25285. 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. This also removes an entirely obsolete and bitrotted testcase for PR7662. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6a6f29c0d8
commit
5ea3570b6a
@ -698,10 +698,15 @@ 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<DICompileUnit>(MD), "invalid compile unit", &NMD, MD);
|
||||
}
|
||||
|
||||
if (!MD)
|
||||
continue;
|
||||
|
@ -3,57 +3,49 @@
|
||||
; 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" ; <[1 x i8*]*> [#uses=0]
|
||||
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.foo*, i32)* @_ZN3foo3bazEi to i8*)], section "llvm.metadata"
|
||||
|
||||
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 ; <i32> [#uses=1]
|
||||
%1 = add nsw i32 %0, 1, !dbg !29 ; <i32> [#uses=1]
|
||||
ret i32 %1, !dbg !29
|
||||
; 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
|
||||
}
|
||||
|
||||
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
|
||||
|
||||
!llvm.dbg.cu = !{!4}
|
||||
!llvm.module.flags = !{!34}
|
||||
!llvm.dbg.lv = !{!0, !14, !15, !16, !17, !24, !25, !28}
|
||||
attributes #0 = { noinline nounwind optsize readnone ssp }
|
||||
attributes #1 = { nounwind readnone }
|
||||
|
||||
!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}
|
||||
!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)
|
||||
|
@ -1,28 +0,0 @@
|
||||
; 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}
|
Loading…
x
Reference in New Issue
Block a user