1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
; RUN: opt < %s -passes=pgo-instr-gen -pgo-function-entry-coverage -S | FileCheck %s --implicit-check-not="instrprof.cover" --check-prefixes=CHECK,ENTRY
; RUN: opt < %s -passes=pgo-instr-gen -pgo-block-coverage -S | FileCheck %s --implicit-check-not="instrprof.cover" --check-prefixes=CHECK,BLOCK
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @foo() {
; CHECK-LABEL: entry:
entry:
; ENTRY: call void @llvm.instrprof.cover({{.*}})
%c = call i1 @choice()
br i1 %c, label %if.then, label %if.else
; CHECK-LABEL: if.then:
if.then:
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end
; CHECK-LABEL: if.else:
if.else:
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end
; CHECK-LABEL: if.end:
if.end:
ret void
}
define void @bar() {
; CHECK-LABEL: entry:
entry:
; ENTRY: call void @llvm.instrprof.cover({{.*}})
%c = call i1 @choice()
br i1 %c, label %if.then, label %if.end
; CHECK-LABEL: if.then:
if.then:
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end
; CHECK-LABEL: if.end:
if.end:
; BLOCK: call void @llvm.instrprof.cover({{.*}})
ret void
}
define void @goo() {
; CHECK-LABEL: entry:
entry:
; CHECK: call void @llvm.instrprof.cover({{.*}})
ret void
}
define void @loop() {
; CHECK-LABEL: entry:
entry:
; CHECK: call void @llvm.instrprof.cover({{.*}})
br label %while
while:
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %while
}
; Function Attrs: noinline nounwind ssp uwtable
define void @hoo(i32 %a) #0 {
; CHECK-LABEL: entry:
entry:
; ENTRY: call void @llvm.instrprof.cover({{.*}})
%a.addr = alloca i32, align 4
%i = alloca i32, align 4
store i32 %a, i32* %a.addr, align 4
%0 = load i32, i32* %a.addr, align 4
%rem = srem i32 %0, 2
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %if.then, label %if.else
; CHECK-LABEL: if.then:
if.then: ; preds = %entry
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end
; CHECK-LABEL: if.else:
if.else: ; preds = %entry
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end
; CHECK-LABEL: if.end:
if.end: ; preds = %if.else, %if.then
store i32 1, i32* %i, align 4
br label %for.cond
; CHECK-LABEL: for.cond:
for.cond: ; preds = %for.inc, %if.end
%1 = load i32, i32* %i, align 4
%2 = load i32, i32* %a.addr, align 4
%cmp1 = icmp slt i32 %1, %2
br i1 %cmp1, label %for.body, label %for.end
; CHECK-LABEL: for.body:
for.body: ; preds = %for.cond
%3 = load i32, i32* %a.addr, align 4
%rem2 = srem i32 %3, 3
%cmp3 = icmp eq i32 %rem2, 0
br i1 %cmp3, label %if.then4, label %if.else5
; CHECK-LABEL: if.then4:
if.then4: ; preds = %for.body
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end10
; CHECK-LABEL: if.else5:
if.else5: ; preds = %for.body
%4 = load i32, i32* %a.addr, align 4
%rem6 = srem i32 %4, 1001
%cmp7 = icmp eq i32 %rem6, 0
br i1 %cmp7, label %if.then8, label %if.end9
; CHECK-LABEL: if.then8:
if.then8: ; preds = %if.else5
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %return
; CHECK-LABEL: if.end9:
if.end9: ; preds = %if.else5
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %if.end10
; CHECK-LABEL: if.end10:
if.end10: ; preds = %if.end9, %if.then4
br label %for.inc
; CHECK-LABEL: for.inc:
for.inc: ; preds = %if.end10
%5 = load i32, i32* %i, align 4
%inc = add nsw i32 %5, 1
store i32 %inc, i32* %i, align 4
br label %for.cond
; CHECK-LABEL: for.end:
for.end: ; preds = %for.cond
; BLOCK: call void @llvm.instrprof.cover({{.*}})
br label %return
; CHECK-LABEL: return:
return: ; preds = %for.end, %if.then8
ret void
}
declare i1 @choice()
; CHECK: declare void @llvm.instrprof.cover({{.*}})
|