1 ; RUN: opt < %s -sample-profile-icp-max-prom=2 -passes=sample-profile -sample-profile-file=%S/Inputs/norepeated-icp-2.prof -S | FileCheck %s --check-prefix=MAX2
2 ; RUN: opt < %s -sample-profile-icp-max-prom=4 -passes=sample-profile -sample-profile-file=%S/Inputs/norepeated-icp-2.prof -S | FileCheck %s --check-prefix=MAX4
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 @.str = private unnamed_addr constant [5 x i8] c"moo\0A\00", align 1
8 @p = dso_local global ptr null, align 8
9 @cond = dso_local global i8 0, align 1
10 @str = private unnamed_addr constant [4 x i8] c"moo\00", align 1
12 ; Function Attrs: uwtable mustprogress
13 define dso_local void @_Z3moov() #0 !dbg !7 {
15 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str), !dbg !9
19 ; Function Attrs: nofree nounwind
20 declare dso_local noundef i32 @printf(ptr nocapture noundef readonly, ...) #1
22 ; Function Attrs: uwtable mustprogress
23 define dso_local void @_Z3hoov() #0 !dbg !11 {
25 %0 = load volatile i8, ptr @cond, align 1, !dbg !12, !range !17
26 %tobool.not = icmp eq i8 %0, 0, !dbg !12
27 br i1 %tobool.not, label %if.end, label %if.then, !dbg !12
29 if.then: ; preds = %entry
30 call void @_Z10hoo_calleev(), !dbg !18
31 br label %if.end, !dbg !18
33 if.end: ; preds = %if.then, %entry
34 store ptr @_Z3moov, ptr @p, align 8, !dbg !19
38 declare !dbg !23 dso_local void @_Z10hoo_calleev() #2
40 ; MAX2-LABEL: @_Z3goov(
41 ; MAX2: icmp eq ptr {{.*}} @_Z3hoov
42 ; MAX2: call void %t0(), {{.*}} !prof ![[PROF_ID1:[0-9]+]]
43 ; MAX2-NOT: icmp eq ptr {{.*}} @_Z3hoov
44 ; MAX2-NOT: icmp eq ptr {{.*}} @_Z3moov
45 ; MAX2: call void %t1(), {{.*}} !prof ![[PROF_ID2:[0-9]+]]
46 ; MAX2-NOT: icmp eq ptr {{.*}} @_Z3hoov
47 ; MAX2-NOT: icmp eq ptr {{.*}} @_Z3moov
48 ; MAX2: call void %t2(), {{.*}} !prof ![[PROF_ID2:[0-9]+]]
50 ; MAX4-LABEL: @_Z3goov(
51 ; MAX4: icmp eq ptr {{.*}} @_Z3hoov
52 ; MAX4: icmp eq ptr {{.*}} @_Z3moov
53 ; MAX4: call void %t0(), {{.*}} !prof ![[PROF_ID3:[0-9]+]]
54 ; MAX4: icmp eq ptr {{.*}} @_Z3hoov
55 ; MAX4: icmp eq ptr {{.*}} @_Z3moov
56 ; MAX4: call void %t1(), {{.*}} !prof ![[PROF_ID4:[0-9]+]]
57 ; MAX4-NOT: icmp eq ptr {{.*}} @_Z3hoov
58 ; MAX4-NOT: icmp eq ptr {{.*}} @_Z3moov
59 ; MAX4: call void %t2(), {{.*}} !prof ![[PROF_ID5:[0-9]+]]
62 ; Function Attrs: uwtable mustprogress
63 define dso_local void @_Z3goov() #0 !dbg !24 {
65 %t0 = load ptr, ptr @p, align 8, !dbg !25
66 call void %t0(), !dbg !26, !prof !30
67 %t1 = load ptr, ptr @p, align 8, !dbg !25
68 call void %t1(), !dbg !28, !prof !31
69 %t2 = load ptr, ptr @p, align 8, !dbg !25
70 call void %t2(), !dbg !29, !prof !32
74 ; MAX2: ![[PROF_ID1]] = !{!"VP", i32 0, i64 13000, i64 -7701940972712279918, i64 -1, i64 1850239051784516332, i64 -1}
75 ; MAX2: ![[PROF_ID2]] = !{!"VP", i32 0, i64 13000, i64 3137940972712279918, i64 -1, i64 1850239051784516332, i64 -1}
76 ; MAX4: ![[PROF_ID3]] = !{!"VP", i32 0, i64 13000, i64 -7383239051784516332, i64 -1, i64 -7701940972712279918, i64 -1, i64 1850239051784516332, i64 -1, i64 9191153033785521275, i64 2000}
77 ; MAX4: ![[PROF_ID4]] = !{!"VP", i32 0, i64 13000, i64 -7383239051784516332, i64 -1, i64 -7701940972712279918, i64 -1, i64 3137940972712279918, i64 -1, i64 1850239051784516332, i64 -1}
78 ; MAX4: ![[PROF_ID5]] = !{!"VP", i32 0, i64 13000, i64 4128940972712279918, i64 -1, i64 3137940972712279918, i64 -1, i64 2132940972712279918, i64 -1, i64 1850239051784516332, i64 -1}
80 ; Function Attrs: nofree nounwind
81 declare noundef i32 @puts(ptr nocapture noundef readonly) #3
83 attributes #0 = { uwtable mustprogress "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-sample-profile" "use-soft-float"="false" }
84 attributes #1 = { nofree nounwind "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
85 attributes #2 = { "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
86 attributes #3 = { nofree nounwind }
89 !llvm.module.flags = !{!3, !4, !5}
92 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git f8226e6e284e9f199790bdb330f87d71adb5376f)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None)
93 !1 = !DIFile(filename: "1.cc", directory: "/usr/local/google/home/wmi/workarea/llvm/build/splitprofile")
95 !3 = !{i32 7, !"Dwarf Version", i32 4}
96 !4 = !{i32 2, !"Debug Info Version", i32 3}
97 !5 = !{i32 1, !"wchar_size", i32 4}
98 !6 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git f8226e6e284e9f199790bdb330f87d71adb5376f)"}
99 !7 = distinct !DISubprogram(name: "moo", linkageName: "_Z3moov", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
100 !8 = !DISubroutineType(types: !2)
101 !9 = !DILocation(line: 2, column: 3, scope: !7)
102 !10 = !DILocation(line: 3, column: 1, scope: !7)
103 !11 = distinct !DISubprogram(name: "hoo", linkageName: "_Z3hoov", scope: !1, file: !1, line: 9, type: !8, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
104 !12 = !DILocation(line: 10, column: 7, scope: !11)
105 !13 = !{!14, !14, i64 0}
106 !14 = !{!"bool", !15, i64 0}
107 !15 = !{!"omnipotent char", !16, i64 0}
108 !16 = !{!"Simple C++ TBAA"}
110 !18 = !DILocation(line: 11, column: 5, scope: !11)
111 !19 = !DILocation(line: 12, column: 5, scope: !11)
112 !20 = !{!21, !21, i64 0}
113 !21 = !{!"any pointer", !15, i64 0}
114 !22 = !DILocation(line: 13, column: 1, scope: !11)
115 !23 = !DISubprogram(name: "hoo_callee", linkageName: "_Z10hoo_calleev", scope: !1, file: !1, line: 5, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
116 !24 = distinct !DISubprogram(name: "goo", linkageName: "_Z3goov", scope: !1, file: !1, line: 15, type: !8, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
117 !25 = !DILocation(line: 16, column: 5, scope: !24)
118 !26 = !DILocation(line: 16, column: 3, scope: !24)
119 !27 = !DILocation(line: 19, column: 1, scope: !24)
120 !28 = !DILocation(line: 17, column: 3, scope: !24)
121 !29 = !DILocation(line: 18, column: 3, scope: !24)
122 !30 = !{!"VP", i32 0, i64 0, i64 1850239051784516332, i64 -1}
123 !31 = !{!"VP", i32 0, i64 0, i64 1850239051784516332, i64 -1, i64 3137940972712279918, i64 -1}
124 !32 = !{!"VP", i32 0, i64 0, i64 1850239051784516332, i64 -1, i64 3137940972712279918, i64 -1, i64 2132940972712279918, i64 -1, i64 4128940972712279918, i64 -1}