[AMDGPU] Add True16 register classes.
[llvm-project.git] / llvm / test / Transforms / PGOProfile / loop2.ll
blob071f8a6d5ad5949f13f120d958627710bce32d1e
1 ; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
2 ; RUN: llvm-profdata merge %S/Inputs/loop2.proftext -o %t.profdata
3 ; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
4 ; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
5 ; RUN: llvm-profdata merge %S/Inputs/loop2_entry.proftext -o %t.profdata
6 ; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
7 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 ; GEN: $__llvm_profile_raw_version = comdat any
11 ; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
12 ; GEN: @__profn_test_nested_for = private constant [15 x i8] c"test_nested_for"
14 define i32 @test_nested_for(i32 %r, i32 %s) {
15 entry:
16 ; GEN: entry:
17 ; NOTENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 2)
18 ; ENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 0)
19   br label %for.cond.outer
21 for.cond.outer:
22 ; GEN: for.cond.outer:
23 ; GEN-NOT: call void @llvm.instrprof.increment
24   %i.0 = phi i32 [ 0, %entry ], [ %inc.2, %for.inc.outer ]
25   %sum.0 = phi i32 [ 1, %entry ], [ %sum.1, %for.inc.outer ]
26   %cmp = icmp slt i32 %i.0, %r
27   br i1 %cmp, label %for.body.outer, label %for.end.outer
28 ; USE: br i1 %cmp, label %for.body.outer, label %for.end.outer
29 ; USE-SAME: !prof ![[BW_FOR_COND_OUTER:[0-9]+]]
31 for.body.outer:
32 ; GEN: for.body.outer:
33 ; GEN-NOT: call void @llvm.instrprof.increment
34   br label %for.cond.inner
36 for.cond.inner:
37 ; GEN: for.cond.inner:
38 ; GEN-NOT: call void @llvm.instrprof.increment
39   %j.0 = phi i32 [ 0, %for.body.outer ], [ %inc.1, %for.inc.inner ]
40   %sum.1 = phi i32 [ %sum.0, %for.body.outer ], [ %inc, %for.inc.inner ]
41   %cmp2 = icmp slt i32 %j.0, %s
42   br i1 %cmp2, label %for.body.inner, label %for.end.inner
43 ; USE: br i1 %cmp2, label %for.body.inner, label %for.end.inner
44 ; USE-SAME: !prof ![[BW_FOR_COND_INNER:[0-9]+]]
46 for.body.inner:
47 ; GEN: for.body.inner:
48 ; GEN-NOT: call void @llvm.instrprof.increment
49   %inc = add nsw i32 %sum.1, 1
50   br label %for.inc.inner
52 for.inc.inner:
53 ; GEN: for.inc.inner:
54 ; NOTENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 0)
55 ; ENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 1)
56   %inc.1 = add nsw i32 %j.0, 1
57   br label %for.cond.inner
59 for.end.inner:
60 ; GEN: for.end.inner:
61   br label %for.inc.outer
63 for.inc.outer:
64 ; GEN: for.inc.outer:
65 ; NOTENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 1)
66 ; ENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 2)
67   %inc.2 = add nsw i32 %i.0, 1
68   br label %for.cond.outer
70 for.end.outer:
71 ; GEN: for.end.outer:
72 ; GEN-NOT: call void @llvm.instrprof.increment
73 ; GEN: ret i32
74   ret i32 %sum.0
77 ; USE-DAG: ![[BW_FOR_COND_OUTER]] = !{!"branch_weights", i32 10, i32 6}
78 ; USE-DAG: ![[BW_FOR_COND_INNER]] = !{!"branch_weights", i32 33, i32 10}