brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · a411436 Raw
49 lines · cpp
1// XFAIL: target={{.*}}-aix{{.*}}2// Test that the instrumentation puts the right linkage on the profile data for3// inline functions.4// RUN: %clang_profgen -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_15// RUN: %clang_profgen -g -fcoverage-mapping -c -o %t2.o %s6// RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe7// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe8// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s9 10// Again, with optimizations and inlining. This tests that we use comdats11// correctly.12// RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_113// RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t2.o %s14// RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe15// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe16// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s17 18// CHECK:  {{.*}}foo{{.*}}:19// CHECK-NEXT:    Hash:20// CHECK-NEXT:    Counters: 121// CHECK-NEXT:    Function count: 122// CHECK:  {{.*}}inline_wrapper{{.*}}:23// CHECK-NEXT:    Hash:24// CHECK-NEXT:    Counters: 125// CHECK-NEXT:    Function count: 226// CHECK:  main:27// CHECK-NEXT:    Hash:28// CHECK-NEXT:    Counters: 129// CHECK-NEXT:    Function count: 130 31extern "C" int puts(const char *);32 33inline void inline_wrapper(const char *msg) {34  puts(msg);35}36 37void foo();38 39#ifdef OBJECT_140void foo() {41  inline_wrapper("foo");42}43#else44int main() {45  inline_wrapper("main");46  foo();47}48#endif49