[SimplifyLibCalls] Remove useless bits of this tests.
[oota-llvm.git] / test / Transforms / SampleProfile / offset.ll
1 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/offset.prof | opt -analyze -branch-prob | FileCheck %s
2
3 ; Original C++ code for this test case:
4 ;
5 ; a.cc:
6 ; #1
7 ; #2
8 ; #3
9 ; #4
10 ; #5 int foo(int a) {
11 ; #6 #include "a.b"
12 ; #7}
13 ;
14 ; a.b:
15 ; #1 if (a > 0) {
16 ; #2   return 10;
17 ; #3 } else {
18 ; #4   return 20;
19 ; #5 }
20
21 ; Function Attrs: nounwind uwtable
22 define i32 @_Z3fooi(i32 %a) #0 !dbg !4 {
23 entry:
24   %retval = alloca i32, align 4
25   %a.addr = alloca i32, align 4
26   store i32 %a, i32* %a.addr, align 4
27   call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !11, metadata !12), !dbg !13
28   %0 = load i32, i32* %a.addr, align 4, !dbg !14
29   %cmp = icmp sgt i32 %0, 0, !dbg !18
30   br i1 %cmp, label %if.then, label %if.else, !dbg !19
31 ; CHECK: edge entry -> if.then probability is 0x0147ae14 / 0x80000000 = 1.00%
32 ; CHECK: edge entry -> if.else probability is 0x7eb851ec / 0x80000000 = 99.00% [HOT edge]
33
34 if.then:                                          ; preds = %entry
35   store i32 10, i32* %retval, align 4, !dbg !20
36   br label %return, !dbg !20
37
38 if.else:                                          ; preds = %entry
39   store i32 20, i32* %retval, align 4, !dbg !22
40   br label %return, !dbg !22
41
42 return:                                           ; preds = %if.else, %if.then
43   %1 = load i32, i32* %retval, align 4, !dbg !24
44   ret i32 %1, !dbg !24
45 }
46
47 ; Function Attrs: nounwind readnone
48 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
49
50 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
51 attributes #1 = { nounwind readnone }
52
53 !llvm.dbg.cu = !{!0}
54 !llvm.module.flags = !{!8, !9}
55 !llvm.ident = !{!10}
56
57 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 250750)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
58 !1 = !DIFile(filename: "a.cc", directory: "/tmp")
59 !2 = !{}
60 !3 = !{!4}
61 !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
62 !5 = !DISubroutineType(types: !6)
63 !6 = !{!7, !7}
64 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
65 !8 = !{i32 2, !"Dwarf Version", i32 4}
66 !9 = !{i32 2, !"Debug Info Version", i32 3}
67 !10 = !{!"clang version 3.8.0 (trunk 250750)"}
68 !11 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 5, type: !7)
69 !12 = !DIExpression()
70 !13 = !DILocation(line: 5, column: 13, scope: !4)
71 !14 = !DILocation(line: 1, column: 5, scope: !15)
72 !15 = distinct !DILexicalBlock(scope: !17, file: !16, line: 1, column: 5)
73 !16 = !DIFile(filename: "./a.b", directory: "/tmp")
74 !17 = !DILexicalBlockFile(scope: !4, file: !16, discriminator: 0)
75 !18 = !DILocation(line: 1, column: 7, scope: !15)
76 !19 = !DILocation(line: 1, column: 5, scope: !17)
77 !20 = !DILocation(line: 2, column: 3, scope: !21)
78 !21 = distinct !DILexicalBlock(scope: !15, file: !16, line: 1, column: 12)
79 !22 = !DILocation(line: 4, column: 3, scope: !23)
80 !23 = distinct !DILexicalBlock(scope: !15, file: !16, line: 3, column: 8)
81 !24 = !DILocation(line: 7, column: 1, scope: !25)
82 !25 = !DILexicalBlockFile(scope: !4, file: !1, discriminator: 0)