DebugInfo: Fix testcases that fail -verify-debug-info=true
[oota-llvm.git] / test / Transforms / GCOVProfiling / return-block.ll
1 ; Inject metadata to set the .gcno file location
2 ; RUN: echo '!19 = !{!"%/T/return-block.ll", !0}' > %t1
3 ; RUN: cat %s %t1 > %t2
4 ; RUN: opt -insert-gcov-profiling -disable-output %t2
5 ; RUN: llvm-cov gcov -n -dump %T/return-block.gcno 2>&1 | FileCheck %s
6
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
9
10 @A = common global i32 0, align 4
11
12 ; Function Attrs: nounwind uwtable
13 define void @test() #0 {
14 entry:
15   tail call void (...)* @f() #2, !dbg !14
16   %0 = load i32, i32* @A, align 4, !dbg !15
17   %tobool = icmp eq i32 %0, 0, !dbg !15
18   br i1 %tobool, label %if.end, label %if.then, !dbg !15
19
20 if.then:                                          ; preds = %entry
21   tail call void (...)* @g() #2, !dbg !16
22   br label %if.end, !dbg !16
23
24 if.end:                                           ; preds = %entry, %if.then
25   ret void, !dbg !18
26 }
27
28 declare void @f(...) #1
29
30 declare void @g(...) #1
31
32 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
33 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
34 attributes #2 = { nounwind }
35
36 !llvm.gcov = !{!19}
37 !llvm.dbg.cu = !{!0}
38 !llvm.module.flags = !{!11, !12}
39 !llvm.ident = !{!13}
40
41 !0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 (trunk 223182)", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !8, imports: !2)
42 !1 = !MDFile(filename: ".../llvm/test/Transforms/GCOVProfiling/return-block.ll", directory: "")
43 !2 = !{}
44 !3 = !{!4}
45 !4 = !MDSubprogram(name: "test", line: 5, isLocal: false, isDefinition: true, isOptimized: true, scopeLine: 5, file: !1, scope: !5, type: !6, function: void ()* @test, variables: !2)
46 !5 = !MDFile(filename: ".../llvm/test/Transforms/GCOVProfiling/return-block.ll", directory: "")
47 !6 = !MDSubroutineType(types: !7)
48 !7 = !{null}
49 !8 = !{!9}
50 !9 = !MDGlobalVariable(name: "A", line: 3, isLocal: false, isDefinition: true, scope: null, file: !5, type: !10, variable: i32* @A)
51 !10 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
52 !11 = !{i32 2, !"Dwarf Version", i32 4}
53 !12 = !{i32 2, !"Debug Info Version", i32 3}
54 !13 = !{!"clang version 3.6.0 (trunk 223182)"}
55 !14 = !MDLocation(line: 6, column: 3, scope: !4)
56 !15 = !MDLocation(line: 7, column: 7, scope: !4)
57 !16 = !MDLocation(line: 8, column: 5, scope: !17)
58 !17 = distinct !MDLexicalBlock(line: 7, column: 7, file: !1, scope: !4)
59 !18 = !MDLocation(line: 9, column: 1, scope: !4)
60
61 ; There should be no destination edges for block 1.
62 ; CHECK: Block : 0 Counter : 0
63 ; CHECK-NEXT:         Destination Edges : 2 (0), 
64 ; CHECK-NEXT: Block : 1 Counter : 0
65 ; CHECK-NEXT:         Source Edges : 4 (0), 
66 ; CHECK-NEXT: Block : 2 Counter : 0