[AArch64][NFC] NFC for const vector as Instruction operand (#116790)
[llvm-project.git] / llvm / test / Transforms / PGOProfile / fix_entry_count_sampled.ll
blob91476d3a16b1ccb104008268a7aa6bd7d253641d
1 ; RUN: rm -rf %t && split-file %s %t
3 ; RUN: llvm-profdata merge %t/main.proftext -o %t/main.profdata
4 ; RUN: opt < %t/main.ll -passes=pgo-instr-use -pgo-test-profile-file=%t/main.profdata -S | FileCheck %s
6 ;--- main.ll
8 ; Instrumentation PGO sampling makes corrupt looking counters possible.  This
9 ; tests one extreme case:
10 ; Test loading zero profile counts for all instrumented blocks while the entry
11 ; block is not instrumented.  Additionally include a non-zero profile count for
12 ; a select instruction, which prevents short circuiting the PGO application.
14 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
15 target triple = "x86_64-unknown-linux-gnu"
17 define i32 @test_no_entry_block_counter(i32 %n) {
18 ; CHECK: define i32 @test_no_entry_block_counter(i32 %n)
19 ; CHECK-SAME: !prof ![[ENTRY_COUNT:[0-9]*]]
20 entry:
21   %cmp = icmp slt i32 42, %n
22   br i1 %cmp, label %tail1, label %tail2
23 tail1:
24   %ret = select i1 true, i32 %n, i32 42
25 ; CHECK:  %ret = select i1 true, i32 %n, i32 42
26 ; CHECK-SAME: !prof ![[BW_FOR_SELECT:[0-9]+]]
27   ret i32 %ret
28 tail2:
29   ret i32 42
31 ; CHECK: ![[ENTRY_COUNT]] = !{!"function_entry_count", i64 1}
32 ; CHECK: ![[BW_FOR_SELECT]] = !{!"branch_weights", i32 1, i32 0}
34 ;--- main.proftext
35 :ir
36 test_no_entry_block_counter
37 431494656217155589