xref: /llvm-project/llvm/test/tools/llvm-profgen/Inputs/truncated-pseudoprobe.ll (revision a273c40820f78d8b08e411897eee84dbda983488)
1target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
2target triple = "x86_64-unknown-linux-gnu"
3
4@.str = private unnamed_addr constant [11 x i8] c"sum is %d\0A\00", align 1
5
6; Function Attrs: nounwind readnone uwtable willreturn
7define dso_local i32 @bar(i32 %x, i32 %y) local_unnamed_addr #0 !dbg !10 {
8entry:
9  call void @llvm.dbg.value(metadata i32 %x, metadata !15, metadata !DIExpression()), !dbg !17
10  call void @llvm.dbg.value(metadata i32 %y, metadata !16, metadata !DIExpression()), !dbg !17
11  call void @llvm.pseudoprobe(i64 -2012135647395072713, i64 1, i32 0, i64 -1), !dbg !18
12  %rem = srem i32 %x, 3, !dbg !20
13  %tobool.not = icmp eq i32 %rem, 0, !dbg !20
14  call void @llvm.pseudoprobe(i64 -2012135647395072713, i64 2, i32 2, i64 -1), !dbg !21
15  call void @llvm.pseudoprobe(i64 -2012135647395072713, i64 3, i32 2, i64 -1), !dbg !23
16  %0 = sub i32 0, %y, !dbg !24
17  %retval.0.p = select i1 %tobool.not, i32 %y, i32 %0, !dbg !24
18  %retval.0 = add i32 %retval.0.p, %x, !dbg !24
19  call void @llvm.pseudoprobe(i64 -2012135647395072713, i64 4, i32 0, i64 -1), !dbg !25
20  ret i32 %retval.0, !dbg !25
21}
22
23; Function Attrs: noinline nounwind uwtable
24define dso_local void @foo() local_unnamed_addr #1 !dbg !26 {
25entry:
26  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 1, i32 0, i64 -1), !dbg !32
27  call void @llvm.dbg.value(metadata i32 0, metadata !30, metadata !DIExpression()), !dbg !33
28  call void @llvm.dbg.value(metadata i32 0, metadata !31, metadata !DIExpression()), !dbg !33
29  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 2, i32 0, i64 -1), !dbg !34
30  call void @llvm.dbg.value(metadata i32 1, metadata !31, metadata !DIExpression()), !dbg !33
31  br label %while.body, !dbg !35
32
33while.body:                                       ; preds = %entry, %if.end
34  %inc8 = phi i32 [ 1, %entry ], [ %inc, %if.end ]
35  %s.07 = phi i32 [ 0, %entry ], [ %s.1, %if.end ]
36  call void @llvm.dbg.value(metadata i32 %s.07, metadata !30, metadata !DIExpression()), !dbg !33
37  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 3, i32 0, i64 -1), !dbg !36
38  %rem = urem i32 %inc8, 91, !dbg !38
39  %tobool.not = icmp eq i32 %rem, 0, !dbg !38
40  br i1 %tobool.not, label %if.else, label %if.then, !dbg !39
41
42if.then:                                          ; preds = %while.body
43  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 4, i32 0, i64 -1), !dbg !40
44  call void @llvm.dbg.value(metadata i32 %inc8, metadata !15, metadata !DIExpression()) #6, !dbg !41
45  call void @llvm.dbg.value(metadata i32 %s.07, metadata !16, metadata !DIExpression()) #6, !dbg !41
46  call void @llvm.pseudoprobe(i64 -2012135647395072713, i64 1, i32 0, i64 -1) #6, !dbg !44
47  %rem.i = urem i32 %inc8, 3, !dbg !45
48  %tobool.not.i = icmp eq i32 %rem.i, 0, !dbg !45
49  %0 = sub i32 0, %s.07, !dbg !48
50  %retval.0.p.i = select i1 %tobool.not.i, i32 %s.07, i32 %0, !dbg !48
51  %retval.0.i = add i32 %retval.0.p.i, %inc8, !dbg !48
52  call void @llvm.pseudoprobe(i64 -2012135647395072713, i64 4, i32 0, i64 -1) #6, !dbg !49
53  call void @llvm.dbg.value(metadata i32 %retval.0.i, metadata !30, metadata !DIExpression()), !dbg !33
54  br label %if.end, !dbg !50
55
56if.else:                                          ; preds = %while.body
57  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 5, i32 0, i64 -1), !dbg !51
58  %add = add nsw i32 %s.07, 30, !dbg !51
59  call void @llvm.dbg.value(metadata i32 %add, metadata !30, metadata !DIExpression()), !dbg !33
60  br label %if.end
61
62if.end:                                           ; preds = %if.else, %if.then
63  %s.1 = phi i32 [ %retval.0.i, %if.then ], [ %add, %if.else ], !dbg !52
64  call void @llvm.dbg.value(metadata i32 %s.1, metadata !30, metadata !DIExpression()), !dbg !33
65  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 6, i32 0, i64 -1), !dbg !35
66  call void @llvm.dbg.value(metadata i32 %inc8, metadata !31, metadata !DIExpression()), !dbg !33
67  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 2, i32 0, i64 -1), !dbg !34
68  %inc = add nuw nsw i32 %inc8, 1, !dbg !34
69  call void @llvm.dbg.value(metadata i32 %inc, metadata !31, metadata !DIExpression()), !dbg !33
70  %exitcond.not = icmp eq i32 %inc, 16000001, !dbg !53
71  br i1 %exitcond.not, label %while.end, label %while.body, !dbg !35, !llvm.loop !54
72
73while.end:                                        ; preds = %if.end
74  call void @llvm.pseudoprobe(i64 6699318081062747564, i64 7, i32 0, i64 -1), !dbg !57
75  %call1 = call i32 (ptr, ...) @printf(ptr nonnull dereferenceable(1) @.str, i32 %s.1), !dbg !58
76  ret void, !dbg !60
77}
78
79; Function Attrs: nofree nounwind
80declare dso_local noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
81
82; Function Attrs: nounwind uwtable
83define dso_local i32 @main() local_unnamed_addr #3 !dbg !61 {
84entry:
85  call void @llvm.pseudoprobe(i64 -2624081020897602054, i64 1, i32 0, i64 -1), !dbg !64
86  call void @foo(), !dbg !65
87  ret i32 0, !dbg !67
88}
89
90; Function Attrs: inaccessiblememonly nounwind willreturn
91declare void @llvm.pseudoprobe(i64, i64, i32, i64) #4
92
93; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
94declare void @llvm.dbg.value(metadata, metadata, metadata) #5
95
96attributes #0 = { nounwind readnone uwtable willreturn "disable-tail-calls"="true" "frame-pointer"="all" "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-soft-float"="false" }
97attributes #1 = { noinline nounwind uwtable "disable-tail-calls"="true" "frame-pointer"="all" "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-soft-float"="false" }
98attributes #2 = { nofree nounwind "disable-tail-calls"="true" "frame-pointer"="all" "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" }
99attributes #3 = { nounwind uwtable "disable-tail-calls"="true" "frame-pointer"="all" "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-soft-float"="false" }
100attributes #4 = { inaccessiblememonly nounwind willreturn }
101attributes #5 = { nofree nosync nounwind readnone speculatable willreturn }
102attributes #6 = { nounwind }
103
104!llvm.dbg.cu = !{!0}
105!llvm.module.flags = !{!3, !4, !5}
106!llvm.ident = !{!6}
107!llvm.pseudo_probe_desc = !{!7, !8, !9}
108
109!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
110!1 = !DIFile(filename: "test.c", directory: "test")
111!2 = !{}
112!3 = !{i32 7, !"Dwarf Version", i32 4}
113!4 = !{i32 2, !"Debug Info Version", i32 3}
114!5 = !{i32 1, !"wchar_size", i32 4}
115!6 = !{!"clang version 12.0.0"}
116!7 = !{i64 -2012135647395072713, i64 72617220756, !"bar", null}
117!8 = !{i64 6699318081062747564, i64 563088904013236, !"foo", null}
118!9 = !{i64 -2624081020897602054, i64 281479271677951, !"main", null}
119!10 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !11, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
120!11 = !DISubroutineType(types: !12)
121!12 = !{!13, !13, !13}
122!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
123!14 = !{!15, !16}
124!15 = !DILocalVariable(name: "x", arg: 1, scope: !10, file: !1, line: 3, type: !13)
125!16 = !DILocalVariable(name: "y", arg: 2, scope: !10, file: !1, line: 3, type: !13)
126!17 = !DILocation(line: 0, scope: !10)
127!18 = !DILocation(line: 4, column: 9, scope: !19)
128!19 = distinct !DILexicalBlock(scope: !10, file: !1, line: 4, column: 9)
129!20 = !DILocation(line: 4, column: 11, scope: !19)
130!21 = !DILocation(line: 5, column: 18, scope: !22)
131!22 = distinct !DILexicalBlock(scope: !19, file: !1, line: 4, column: 16)
132!23 = !DILocation(line: 7, column: 14, scope: !10)
133!24 = !DILocation(line: 4, column: 9, scope: !10)
134!25 = !DILocation(line: 8, column: 1, scope: !10)
135!26 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 11, type: !27, scopeLine: 11, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !29)
136!27 = !DISubroutineType(types: !28)
137!28 = !{null}
138!29 = !{!30, !31}
139!30 = !DILocalVariable(name: "s", scope: !26, file: !1, line: 12, type: !13)
140!31 = !DILocalVariable(name: "i", scope: !26, file: !1, line: 12, type: !13)
141!32 = !DILocation(line: 12, column: 5, scope: !26)
142!33 = !DILocation(line: 0, scope: !26)
143!34 = !DILocation(line: 13, column: 15, scope: !26)
144!35 = !DILocation(line: 13, column: 7, scope: !26)
145!36 = !DILocation(line: 14, column: 17, scope: !37)
146!37 = distinct !DILexicalBlock(scope: !26, file: !1, line: 14, column: 17)
147!38 = !DILocation(line: 14, column: 19, scope: !37)
148!39 = !DILocation(line: 14, column: 17, scope: !26)
149!40 = !DILocation(line: 14, column: 33, scope: !37)
150!41 = !DILocation(line: 0, scope: !10, inlinedAt: !42)
151!42 = distinct !DILocation(line: 14, column: 29, scope: !43)
152!43 = !DILexicalBlockFile(scope: !37, file: !1, discriminator: 186646599)
153!44 = !DILocation(line: 4, column: 9, scope: !19, inlinedAt: !42)
154!45 = !DILocation(line: 4, column: 11, scope: !19, inlinedAt: !42)
155!46 = !DILocation(line: 5, column: 18, scope: !22, inlinedAt: !42)
156!47 = !DILocation(line: 7, column: 14, scope: !10, inlinedAt: !42)
157!48 = !DILocation(line: 4, column: 9, scope: !10, inlinedAt: !42)
158!49 = !DILocation(line: 8, column: 1, scope: !10, inlinedAt: !42)
159!50 = !DILocation(line: 14, column: 25, scope: !37)
160!51 = !DILocation(line: 14, column: 47, scope: !37)
161!52 = !DILocation(line: 0, scope: !37)
162!53 = !DILocation(line: 13, column: 18, scope: !26)
163!54 = distinct !{!54, !35, !55, !56}
164!55 = !DILocation(line: 14, column: 50, scope: !26)
165!56 = !{!"llvm.loop.mustprogress"}
166!57 = !DILocation(line: 15, column: 31, scope: !26)
167!58 = !DILocation(line: 15, column: 9, scope: !59)
168!59 = !DILexicalBlockFile(scope: !26, file: !1, discriminator: 186646607)
169!60 = !DILocation(line: 16, column: 1, scope: !26)
170!61 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 18, type: !62, scopeLine: 18, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
171!62 = !DISubroutineType(types: !63)
172!63 = !{!13}
173!64 = !DILocation(line: 19, column: 5, scope: !61)
174!65 = !DILocation(line: 19, column: 5, scope: !66)
175!66 = !DILexicalBlockFile(scope: !61, file: !1, discriminator: 7)
176!67 = !DILocation(line: 20, column: 7, scope: !61)
177