xref: /llvm-project/llvm/test/Transforms/PGOProfile/maxcountzero.ll (revision a74c5707be279bdddb51fe49aa9383c1ddc99fbe)
1; Make sure a profile that is generated from a function without an exit node
2; does not cause an assertion. The profile consists of a non-zero count in a
3; basic block and 0 counts in all succcessor blocks. Expect a warning.
4
5; RUN: llvm-profdata merge %S/Inputs/maxcountzero.proftext -o %t.profdata
6; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
7
8define void @bar(i32 noundef %s) {
9entry:
10  %cmp = icmp sgt i32 %s, 20
11  br i1 %cmp, label %if.then, label %if.end
12
13if.then:
14  call void @exit(i32 noundef 1)
15  unreachable
16
17if.end:
18  ret void
19}
20
21declare void @exit(i32 noundef)
22
23define void @foo(i32 noundef %n) {
24entry:
25  %sum = alloca i32, align 4
26  store volatile i32 %n, ptr %sum, align 4
27  %sum.0.sum.0. = load volatile i32, ptr %sum, align 4
28  call void @bar(i32 noundef %sum.0.sum.0.)
29  %cmp = icmp slt i32 %n, 10
30  br i1 %cmp, label %if.then, label %if.end
31
32if.then:
33  %sum.0.sum.0.1 = load volatile i32, ptr %sum, align 4
34  call void @bar(i32 noundef %sum.0.sum.0.1)
35  br label %if.end
36
37if.end:
38  br label %for.cond
39
40for.cond:
41  %sum.0.sum.0.2 = load volatile i32, ptr %sum, align 4
42  call void @bar(i32 noundef %sum.0.sum.0.2)
43  br label %for.cond
44}
45
46; CHECK: warning:{{.*}}Profile in foo partially ignored
47; CHECK: define
48