1/// Without PIE function addresses are the same across runs and their value
2/// sites can be merged, matching the test.
3// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie
4// RUN: rm -rf %t.profdir
5// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
6// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
7// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
8// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
9// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
10// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c
11
12/// -z start-stop-gc requires binutils 2.37. Don't test the option for now.
13/// TODO: Add -Wl,--gc-sections.
14// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=bfd -ffunction-sections -fdata-sections
15// RUN: rm -rf %t.profdir
16// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
17// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
18// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
19// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
20// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
21// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c
22
23// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=gold -ffunction-sections -fdata-sections
24// RUN: rm -rf %t.profdir
25// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
26// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
27// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
28// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
29// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
30// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c
31

source code of compiler-rt/test/profile/Linux/instrprof-value-merge.c