xref: /aosp_15_r20/external/compiler-rt/test/profile/instrprof-value-prof-shared.test (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot// RUN: mkdir -p %t.d
2*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.shared -DSHARED_LIB %S/Inputs/instrprof-value-prof-real.c
3*7c3d14c8STreehugger Robot// RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t -rpath %t.d %t.d/t.shared -DCALL_SHARED %S/Inputs/instrprof-value-prof-real.c
4*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255  %run %t
5*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.profdata %t.profraw
6*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
7*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
8*7c3d14c8STreehugger Robot
9*7c3d14c8STreehugger Robot// IR level instrumentation
10*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 -fPIC -shared -o %t.d/t.ir.shared -DSHARED_LIB  %S/Inputs/instrprof-value-prof-real.c
11*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 -rpath %t.d -o %t.ir %t.d/t.ir.shared -DCALL_SHARED  %S/Inputs/instrprof-value-prof-real.c
12*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.ir.profraw  LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir
13*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw
14*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
15*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -text  %t.ir.profdata -o %t.ir.proftxt
16*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
17*7c3d14c8STreehugger Robot// RUN: FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt
18*7c3d14c8STreehugger Robot
19*7c3d14c8STreehugger Robot// IR level instrumentation: dynamic memory allocation
20*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 -fPIC -shared -o %t.d/t.ir.dyn.shared -DSHARED_LIB  %S/Inputs/instrprof-value-prof-real.c
21*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 -rpath %t.d -o %t.ir.dyn %t.d/t.ir.dyn.shared -DCALL_SHARED  %S/Inputs/instrprof-value-prof-real.c
22*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn
23*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw
24*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.dyn.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
25*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -text  %t.ir.dyn.profdata -o %t.ir.dyn.proftxt
26*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.dyn.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
27*7c3d14c8STreehugger Robot// RUN: FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt
28*7c3d14c8STreehugger Robot
29*7c3d14c8STreehugger Robot// IR level instrumentation: main program uses static counter, shared library uses dynamic memory alloc.
30*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 -fPIC -shared -o %t.d/t.ir.dyn.shared -DSHARED_LIB  %S/Inputs/instrprof-value-prof-real.c
31*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 -rpath %t.d -o %t.ir.mixed %t.d/t.ir.dyn.shared -DCALL_SHARED  %S/Inputs/instrprof-value-prof-real.c
32*7c3d14c8STreehugger Robot// RUN: env LLVM_PROFILE_FILE=%t.ir.mixed.profraw  LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.mixed
33*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -o %t.ir.mixed.profdata %t.ir.mixed.profraw
34*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.mixed.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c
35*7c3d14c8STreehugger Robot// RUN: llvm-profdata merge -text  %t.ir.mixed.profdata -o %t.ir.mixed.proftxt
36*7c3d14c8STreehugger Robot// RUN: llvm-profdata show --all-functions -ic-targets  %t.ir.mixed.profdata | FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
37*7c3d14c8STreehugger Robot// RUN: FileCheck  %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.mixed.proftxt
38