Skip to content

Commit

Permalink
Debug Info: update testing cases to specify the debug info version nu…
Browse files Browse the repository at this point in the history
…mber.

We are going to drop debug info without a version number or with a different
version number, to make sure we don't crash when we see bitcode files with
different debug info metadata format.

Make tests more robust by removing hard-coded metadata numbers in CHECK lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195535 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
manman-ren committed Nov 23, 2013
1 parent fbe605e commit bc8569d
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 16 deletions.
24 changes: 17 additions & 7 deletions test/Assembler/functionlocal-metadata.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
define void @Foo(i32 %a, i32 %b) {
entry:
call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !2)
; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata !2)
; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata ![[ID2:[0-9]+]])
%0 = add i32 %a, 1 ; <i32> [#uses=1]
%two = add i32 %b, %0 ; <i32> [#uses=0]
%1 = alloca i32 ; <i32*> [#uses=1]
Expand All @@ -19,28 +19,38 @@ entry:
call void @llvm.dbg.declare(metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"})
; CHECK: metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"}
call void @llvm.dbg.declare(metadata !{i32 %b}, metadata !{metadata !0, i32 %two})
; CHECK: metadata !{i32 %b}, metadata !{metadata !0, i32 %two}
; CHECK: metadata !{i32 %b}, metadata !{metadata ![[ID0:[0-9]+]], i32 %two}

call void @llvm.dbg.value(metadata !{ i32 %a }, i64 0, metadata !1)
; CHECK: metadata !{i32 %a}, i64 0, metadata !1
; CHECK: metadata !{i32 %a}, i64 0, metadata ![[ID1:[0-9]+]]
call void @llvm.dbg.value(metadata !{ i32 %0 }, i64 25, metadata !0)
; CHECK: metadata !{i32 %0}, i64 25, metadata !0
; CHECK: metadata !{i32 %0}, i64 25, metadata ![[ID0]]
call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !3)
; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata !3)
; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata ![[ID3:[0-9]+]])
call void @llvm.dbg.value(metadata !3, i64 12, metadata !2)
; CHECK: metadata !3, i64 12, metadata !2
; CHECK: metadata ![[ID3]], i64 12, metadata ![[ID2]]

ret void, !foo !0, !bar !1
; CHECK: ret void, !foo !0, !bar !1
; CHECK: ret void, !foo ![[FOO:[0-9]+]], !bar ![[BAR:[0-9]+]]
}

!llvm.module.flags = !{!4}

!0 = metadata !{i32 662302, i32 26, metadata !1, null}
!1 = metadata !{i32 4, metadata !"foo"}
!2 = metadata !{metadata !"bar"}
!3 = metadata !{metadata !"foo"}
!4 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}

declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone

!foo = !{ !0 }
!bar = !{ !1 }

; CHECK: !foo = !{![[FOO]]}
; CHECK: !bar = !{![[BAR]]}
; CHECK: ![[ID0]] = metadata !{i32 662302, i32 26, metadata ![[ID1]], null}
; CHECK: ![[ID1]] = metadata !{i32 4, metadata !"foo"}
; CHECK: ![[ID2]] = metadata !{metadata !"bar"}
; CHECK; ![[ID3]] = metadata !{metadata !"foo"}
15 changes: 9 additions & 6 deletions test/BugPoint/metadata.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

; Bugpoint should keep the call's metadata attached to the call.

; CHECK: call void @foo(), !dbg !0, !attach !4
; CHECK: !0 = metadata !{i32 104, i32 105, metadata !1, metadata !1}
; CHECK: !1 = metadata !{i32 458769, metadata !2, i32 0, metadata !"me", i1 true, metadata !"", i32 0, metadata !3, metadata !3, null, null, null, metadata !""}
; CHECK: !2 = metadata !{metadata !"source.c", metadata !"/dir"}
; CHECK: !3 = metadata !{i32 0}
; CHECK: !4 = metadata !{metadata !"the call to foo"}
; CHECK: call void @foo(), !dbg ![[LOC:[0-9]+]], !attach ![[CALL:[0-9]+]]
; CHECK: ![[LOC]] = metadata !{i32 104, i32 105, metadata ![[SCOPE:[0-9]+]], metadata ![[SCOPE]]}
; CHECK: ![[SCOPE]] = metadata !{i32 458769, metadata ![[FILE:[0-9]+]], i32 0, metadata !"me", i1 true, metadata !"", i32 0, metadata ![[LIST:[0-9]+]], metadata ![[LIST]], null, null, null, metadata !""}
; CHECK: ![[FILE]] = metadata !{metadata !"source.c", metadata !"/dir"}
; CHECK: ![[LIST]] = metadata !{i32 0}
; CHECK: ![[CALL]] = metadata !{metadata !"the call to foo"}

%rust_task = type {}
define void @test(i32* %a, i8* %b) {
Expand All @@ -23,6 +23,8 @@ define void @test(i32* %a, i8* %b) {

declare void @foo()

!llvm.module.flags = !{!17}

!0 = metadata !{metadata !"boring"}
!1 = metadata !{metadata !"uninteresting"}
!2 = metadata !{metadata !"the call to foo"}
Expand All @@ -37,3 +39,4 @@ declare void @foo()
!14 = metadata !{i32 108, i32 109, metadata !9, metadata !9}
!15 = metadata !{metadata !"source.c", metadata !"/dir"}
!16 = metadata !{i32 0}
!17 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
3 changes: 3 additions & 0 deletions test/CodeGen/ARM/debug-info-branch-folding.ll
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ declare i32 @printf(i8* nocapture, ...) nounwind

declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone

!llvm.module.flags = !{!56}

!0 = metadata !{i32 786478, metadata !54, null, metadata !"test0001", metadata !"test0001", metadata !"", i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, <4 x float> (float)* @test0001, null, null, metadata !51, i32 0} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 786473, metadata !54} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 786449, metadata !54, i32 12, metadata !"clang version 3.0 (trunk 129915)", i1 true, metadata !"", i32 0, metadata !17, metadata !17, metadata !50, null, null, null} ; [ DW_TAG_compile_unit ]
Expand Down Expand Up @@ -94,3 +96,4 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!53 = metadata !{metadata !30}
!54 = metadata !{metadata !"build2.c", metadata !"/private/tmp"}
!55 = metadata !{metadata !"/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/UnitTests/Vector/helpers.h", metadata !"/private/tmp"}
!56 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
2 changes: 2 additions & 0 deletions test/CodeGen/X86/2012-11-30-misched-dbg.ll
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ if.else4114: ; preds = %if.then4073
declare i32 @__sprintf_chk(i8*, i32, i64, i8*, ...)

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!35}

!0 = metadata !{i32 786449, metadata !19, i32 12, metadata !"clang version 3.3 (trunk 168918) (llvm/trunk 168920)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, null, metadata !""} ; [ DW_TAG_compile_unit ] [MultiSource/Benchmarks/MiBench/consumer-typeset/MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] [DW_LANG_C99]
!1 = metadata !{metadata !2}
Expand Down Expand Up @@ -134,3 +135,4 @@ declare void @_Znwm()
!32 = metadata !{i32 786454, metadata !34, null, metadata !"HM", i32 28, i64 0, i64 0, i64 0, i32 0, null} ; [ DW_TAG_typedef ] [HM] [line 28, size 0, align 0, offset 0] [from ]
!33 = metadata !{i32 786473, metadata !34} ; [ DW_TAG_file_type ]
!34 = metadata !{metadata !"SingleSource/Benchmarks/Shootout-C++/hash.cpp", metadata !"SingleSource/Benchmarks/Shootout-C++"}
!35 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
3 changes: 3 additions & 0 deletions test/Feature/md_on_instruction.ll
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ declare void @llvm.dbg.func.start(metadata) nounwind readnone

declare void @llvm.dbg.region.end(metadata) nounwind readnone

!llvm.module.flags = !{!6}

!0 = metadata !{i32 458798, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 1, metadata !2, i1 false, i1 true}
!1 = metadata !{i32 458769, metadata !4, i32 12, metadata !"clang 1.0", i1 true, metadata !"", i32 0, metadata !5, metadata !5, metadata !4, null, null, metadata !""}
!2 = metadata !{i32 458788, null, metadata !1, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}
!3 = metadata !{i32 1, i32 13, metadata !1, metadata !1}
!4 = metadata !{metadata !"foo.c", metadata !"/tmp"}
!5 = metadata !{i32 0}
!6 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
2 changes: 2 additions & 0 deletions test/Transforms/LICM/debug-value.ll
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ for.end104: ; preds = %for.cond.backedge

declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone

!llvm.module.flags = !{!26}
!llvm.dbg.sp = !{!0, !6, !9, !10}

!0 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"idamax", metadata !"idamax", metadata !"", i32 112, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
Expand Down Expand Up @@ -61,3 +62,4 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!23 = metadata !{i32 296, i32 13, metadata !17, null}
!24 = metadata !{i32 313, i32 1, metadata !14, null}
!25 = metadata !{metadata !"/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/Benchmarks/CoyoteBench/lpbench.c", metadata !"/private/tmp"}
!26 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
2 changes: 2 additions & 0 deletions test/Transforms/LoopIdiom/debug-line.ll
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone

declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone

!llvm.module.flags = !{!19}
!llvm.dbg.sp = !{!0}

!0 = metadata !{i32 589870, metadata !18, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (double*)* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 0] [foo]
Expand All @@ -48,3 +49,4 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!16 = metadata !{i32 3, i32 29, metadata !11, null}
!17 = metadata !{i32 5, i32 1, metadata !12, null}
!18 = metadata !{metadata !"li.c", metadata !"/private/tmp"}
!19 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
2 changes: 2 additions & 0 deletions test/Transforms/LoopRotate/dbgvalue.ll
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ for.end:
ret void
}

!llvm.module.flags = !{!20}
!llvm.dbg.sp = !{!0}

!0 = metadata !{i32 589870, metadata !18, metadata !1, metadata !"tak", metadata !"tak", metadata !"", i32 32, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i32, i32)* @tak, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 32] [def] [scope 0] [tak]
Expand All @@ -99,3 +100,4 @@ for.end:
!17 = metadata !{i32 37, i32 1, metadata !13, null}
!18 = metadata !{metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame"}
!19 = metadata !{i32 0}
!20 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
10 changes: 7 additions & 3 deletions test/Transforms/ObjCARC/basic.ll
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ if.end5: ; preds = %if.then3, %if.end
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW:#[0-9]+]]
; CHECK-NOT: @objc_
; CHECK: if.end5:
; CHECK: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release !0
; CHECK: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release ![[RELEASE:[0-9]+]]
; CHECK-NOT: @objc_
; CHECK: }
define void @test1b_imprecise(i8* %x, i1 %p, i1 %q) {
Expand Down Expand Up @@ -2202,7 +2202,7 @@ define void @test53(void ()** %zz, i8** %pp) {

; CHECK-LABEL: define void @test54(
; CHECK: call i8* @returner()
; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release !0
; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release ![[RELEASE]]
; CHECK-NEXT: ret void
; CHECK: }
define void @test54() {
Expand Down Expand Up @@ -2236,7 +2236,7 @@ entry:
; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
; CHECK-NEXT: tail call void @use_pointer(i8* %x)
; CHECK-NEXT: tail call void @use_pointer(i8* %x)
; CHECK-NEXT: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release !0
; CHECK-NEXT: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release ![[RELEASE]]
; CHECK-NEXT: br label %if.end
; CHECK-NOT: @objc
; CHECK: }
Expand Down Expand Up @@ -3009,7 +3009,11 @@ define void @test67(i8* %x) {
ret void
}

!llvm.module.flags = !{!1}

!0 = metadata !{}
!1 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}

; CHECK: attributes #0 = { nounwind readnone }
; CHECK: attributes [[NUW]] = { nounwind }
; CHECK: ![[RELEASE]] = metadata !{}
2 changes: 2 additions & 0 deletions test/Transforms/SimplifyCFG/hoist-dbgvalue.ll
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ declare i32 @bar(...)

declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone

!llvm.module.flags = !{!21}
!llvm.dbg.sp = !{!0}

!0 = metadata !{i32 589870, metadata !20, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 0] [foo]
Expand All @@ -52,3 +53,4 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!18 = metadata !{i32 8, i32 3, metadata !17, null}
!19 = metadata !{i32 9, i32 3, metadata !10, null}
!20 = metadata !{metadata !"b.c", metadata !"/private/tmp"}
!21 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}

0 comments on commit bc8569d

Please sign in to comment.