1 ; RUN: opt < %s -passes=pgo-instr-gen -pgo-function-entry-coverage -S | FileCheck %s --implicit-check-not="instrprof.cover" --check-prefixes=CHECK,ENTRY
2 ; RUN: opt < %s -passes=pgo-instr-gen -pgo-block-coverage -S | FileCheck %s --implicit-check-not="instrprof.cover" --check-prefixes=CHECK,BLOCK
3 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
9 ; ENTRY: call void @llvm.instrprof.cover({{.*}})
10 %c = call i1 @choice()
11 br i1 %c, label %if.then, label %if.else
13 ; CHECK-LABEL: if.then:
15 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
18 ; CHECK-LABEL: if.else:
20 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
23 ; CHECK-LABEL: if.end:
31 ; ENTRY: call void @llvm.instrprof.cover({{.*}})
32 %c = call i1 @choice()
33 br i1 %c, label %if.then, label %if.end
35 ; CHECK-LABEL: if.then:
37 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
40 ; CHECK-LABEL: if.end:
42 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
49 ; CHECK: call void @llvm.instrprof.cover({{.*}})
56 ; CHECK: call void @llvm.instrprof.cover({{.*}})
59 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
63 ; Function Attrs: noinline nounwind ssp uwtable
64 define void @hoo(i32 %a) #0 {
67 ; ENTRY: call void @llvm.instrprof.cover({{.*}})
68 %a.addr = alloca i32, align 4
69 %i = alloca i32, align 4
70 store i32 %a, i32* %a.addr, align 4
71 %0 = load i32, i32* %a.addr, align 4
73 %cmp = icmp eq i32 %rem, 0
74 br i1 %cmp, label %if.then, label %if.else
76 ; CHECK-LABEL: if.then:
77 if.then: ; preds = %entry
78 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
81 ; CHECK-LABEL: if.else:
82 if.else: ; preds = %entry
83 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
86 ; CHECK-LABEL: if.end:
87 if.end: ; preds = %if.else, %if.then
88 store i32 1, i32* %i, align 4
91 ; CHECK-LABEL: for.cond:
92 for.cond: ; preds = %for.inc, %if.end
93 %1 = load i32, i32* %i, align 4
94 %2 = load i32, i32* %a.addr, align 4
95 %cmp1 = icmp slt i32 %1, %2
96 br i1 %cmp1, label %for.body, label %for.end
98 ; CHECK-LABEL: for.body:
99 for.body: ; preds = %for.cond
100 %3 = load i32, i32* %a.addr, align 4
101 %rem2 = srem i32 %3, 3
102 %cmp3 = icmp eq i32 %rem2, 0
103 br i1 %cmp3, label %if.then4, label %if.else5
105 ; CHECK-LABEL: if.then4:
106 if.then4: ; preds = %for.body
107 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
110 ; CHECK-LABEL: if.else5:
111 if.else5: ; preds = %for.body
112 %4 = load i32, i32* %a.addr, align 4
113 %rem6 = srem i32 %4, 1001
114 %cmp7 = icmp eq i32 %rem6, 0
115 br i1 %cmp7, label %if.then8, label %if.end9
117 ; CHECK-LABEL: if.then8:
118 if.then8: ; preds = %if.else5
119 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
122 ; CHECK-LABEL: if.end9:
123 if.end9: ; preds = %if.else5
124 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
127 ; CHECK-LABEL: if.end10:
128 if.end10: ; preds = %if.end9, %if.then4
131 ; CHECK-LABEL: for.inc:
132 for.inc: ; preds = %if.end10
133 %5 = load i32, i32* %i, align 4
134 %inc = add nsw i32 %5, 1
135 store i32 %inc, i32* %i, align 4
138 ; CHECK-LABEL: for.end:
139 for.end: ; preds = %for.cond
140 ; BLOCK: call void @llvm.instrprof.cover({{.*}})
143 ; CHECK-LABEL: return:
144 return: ; preds = %for.end, %if.then8
150 ; CHECK: declare void @llvm.instrprof.cover({{.*}})