1 ; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
2 ; RUN: llvm-profdata merge %S/Inputs/switch.proftext -o %t.profdata
3 ; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; GEN: @__llvm_profile_name_test_switch = private constant [11 x i8] c"test_switch"
9 define void @test_switch(i32 %i) {
12 ; GEN-NOT: call void @llvm.instrprof.increment
13 switch i32 %i, label %sw.default [
19 ; USE-SAME: !prof ![[BW_SWITCH:[0-9]+]]
20 ; USE: ![[BW_SWITCH]] = !{!"branch_weights", i32 3, i32 2, i32 0, i32 5}
24 ; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 2)
29 ; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 0)
34 ; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 1)
39 ; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 3)
44 ; GEN-NOT: call void @llvm.instrprof.increment