brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 6541ee7 Raw
93 lines · c
1// REQUIRES: linux, lld-available2 3// FIXME: Investigate and fix.4// XFAIL: powerpc64-target-arch5// UNSUPPORTED: powerpc64le-target-arch6 7// RUN: rm -rf %t.profraw8// RUN: %clang_profgen=%t.profraw -fuse-ld=lld -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -ffunction-sections -fdata-sections -Wl,--gc-sections -o %t %s9// RUN: %run %t10// RUN: llvm-profdata merge -o %t.profdata %t.profraw11// RUN: llvm-profdata show --all-functions %t.profdata | FileCheck %s -check-prefix=PROF12// RUN: llvm-cov show %t -instr-profile %t.profdata | FileCheck %s -check-prefix=COV13// RUN: llvm-nm %t | FileCheck %s -check-prefix=NM14// RUN: llvm-readelf -x __llvm_prf_names %t | FileCheck %s -check-prefix=PRF_NAMES15// RUN: llvm-size -A %t | FileCheck %s -check-prefix=PRF_CNTS16 17// RUN: rm -rf %t.lto.profraw18// RUN: %clang_lto_profgen=%t.lto.profraw -fuse-ld=lld -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -ffunction-sections -fdata-sections -Wl,--gc-sections -flto -o %t.lto %s19// RUN: %run %t.lto20// RUN: llvm-profdata merge -o %t.lto.profdata %t.lto.profraw21// RUN: llvm-profdata show --all-functions %t.lto.profdata | FileCheck %s -check-prefix=PROF22// RUN: llvm-cov show %t.lto -instr-profile %t.lto.profdata | FileCheck %s -check-prefix=COV23// RUN: llvm-nm %t.lto | FileCheck %s -check-prefix=NM24// RUN: llvm-readelf -x __llvm_prf_names %t.lto | FileCheck %s -check-prefix=PRF_NAMES25// RUN: llvm-size -A %t.lto | FileCheck %s -check-prefix=PRF_CNTS26 27// Note: We expect foo() and some of the profiling data associated with it to28// be garbage collected.29 30// Note: When there is no code in a program, we expect to see the exact same31// set of external functions provided by the profile runtime.32 33// Note: We also check the IR instrumentation and expect foo() to be garbage34// collected as well.35 36// RUN: rm -rf %t.pgo.profraw37// RUN: %clang_pgogen=%t.pgo.profraw -fuse-ld=lld -DCODE=1 -ffunction-sections -fdata-sections -Wl,--gc-sections -o %t.pgo %s38// RUN: %run %t.pgo39// RUN: llvm-profdata merge -o %t.pgo.profdata %t.pgo.profraw40// RUN: llvm-profdata show --all-functions %t.pgo.profdata | FileCheck %s -check-prefix=PGO41// RUN: llvm-nm %t.pgo | FileCheck %s -check-prefix=NM42 43#ifdef CODE44 45// COV: [[@LINE+1]]{{ *}}|{{ *}}0|void foo()46void foo() {}47 48// COV: [[@LINE+1]]{{ *}}|{{ *}}1|int main49int main() { return 0; }50 51#endif // CODE52 53// NM-NOT: foo54 55// PROF: Counters:56// PROF-NEXT:   main:57// PROF-NEXT:     Hash:58// PROF-NEXT:     Counters: 159// PROF-NEXT:     Function count: 160// PROF-NEXT: Instrumentation level: Front-end61// PROF-NEXT: Functions shown: 162// PROF-NEXT: Total functions: 163// PROF-NEXT: Maximum function count:64// PROF-NEXT: Maximum internal block count:65 66// Note: We don't expect the names of garbage collected functions to disappear67// from __llvm_prf_names, because collectPGOFuncNameStrings() glues the names68// together.69 70// PRF_NAMES: Hex dump of section '__llvm_prf_names':71// PRF_NAMES-NEXT: {{.*}} 0800666f 6f016d61 696e{{.*$}}72//                        | | f o  o # m a  i n73//                        | |___________|74//                        |             |75//               UncompressedLen = 8    |76//                                      |77//                               CompressedLen = 078 79// Note: We expect the profile counters for garbage collected functions to also80// be garbage collected.81 82// PRF_CNTS: __llvm_prf_cnts 883 84// PGO: Counters:85// PGO-NEXT:   main:86// PGO-NEXT:     Hash:87// PGO-NEXT:     Counters: 188// PGO-NEXT: Instrumentation level: IR89// PGO-NEXT: Functions shown: 190// PGO-NEXT: Total functions: 191// PGO-NEXT: Maximum function count:92// PGO-NEXT: Maximum internal block count:93