xref: /aosp_15_r20/external/compiler-rt/test/profile/instrprof-value-prof.test (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t %S/Inputs/instrprof-value-prof-real.c
2*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t
3*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.profdata %t.profraw
4*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
5*7c3d14c8STreehugger Robot
6*7c3d14c8STreehugger Robot// IR level instrumentation
7*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -mllvm -disable-vp=false -Xclang -fprofile-instrument=llvm -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t.ir  %S/Inputs/instrprof-value-prof-real.c
8*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir
9*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw
10*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
11*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -text  %t.ir.profdata -o %t.ir.proftxt
12*7c3d14c8STreehugger Robot// RUN: FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt
13*7c3d14c8STreehugger Robot
14*7c3d14c8STreehugger Robot// IR level instrumentation with dynamic memory allocation
15*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -mllvm -disable-vp=false -Xclang -fprofile-instrument=llvm -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -o %t.ir.dyn  %S/Inputs/instrprof-value-prof-real.c
16*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn
17*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw
18*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.dyn.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
19*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -text  %t.ir.dyn.profdata -o %t.ir.dyn.proftxt
20*7c3d14c8STreehugger Robot// RUN: FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt
21*7c3d14c8STreehugger Robot
22