xref: /llvm-project/llvm/test/Instrumentation/InstrProfiling/before-value-profile-lowering.ll (revision 30f098ef9dfb121bccaef6975b13788b6f940e47)
1259fa708SEllis Hoag; Test to ensure that when the only instrprof increment instruction is
2259fa708SEllis Hoag; increment by step instruction and there is value profile instruction
3259fa708SEllis Hoag; in front of all increment instructions in a function,
4259fa708SEllis Hoag; the profile data variable is generated before value profile lowering
5259fa708SEllis Hoag
6259fa708SEllis Hoag; RUN: opt < %s -passes=instrprof -S | FileCheck %s
7259fa708SEllis Hoag
8259fa708SEllis Hoagtarget triple = "x86_64-unknown-linux-gnu"
9259fa708SEllis Hoag
10*30f098efSFangrui Songdeclare void @llvm.instrprof.increment.step(ptr, i64, i32, i32, i64)
11259fa708SEllis Hoag
12*30f098efSFangrui Songdeclare void @llvm.instrprof.value.profile(ptr, i64, i64, i32, i32)
13259fa708SEllis Hoag
14259fa708SEllis Hoag; CHECK: @__profd_foo = private global
15259fa708SEllis Hoag@__profn_foo = private constant [3 x i8] c"foo"
16259fa708SEllis Hoag
17*30f098efSFangrui Songdefine i32 @foo(ptr ) {
18*30f098efSFangrui Song  %2 = ptrtoint ptr %0 to i64
19*30f098efSFangrui Song  call void @llvm.instrprof.value.profile(ptr @__profn_foo, i64 0, i64 %2, i32 0, i32 0)
20*30f098efSFangrui Song  call void @llvm.instrprof.increment.step(ptr @__profn_foo, i64 0, i32 1, i32 0, i64 0)
21259fa708SEllis Hoag  %3 = tail call i32 %0()
22259fa708SEllis Hoag  ret i32 %3
23259fa708SEllis Hoag}
24