brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ad14e66 Raw
48 lines · c
1// RUN: rm -f %t.profdata2// RUN: %clang_pgogen -o %t -mllvm -pgo-temporal-instrumentation %s3// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t n4// RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t y5// RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input=5,%t.1.profraw6// RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --implicit-check-not=unused7 8// RUN: rm -f %t.profdata9// RUN: %clang_pgogen -o %t -mllvm -pgo-temporal-instrumentation -mllvm -pgo-block-coverage %s10// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t n11// RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t y12// RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input=5,%t.1.profraw13// RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --implicit-check-not=unused14 15extern void exit(int);16extern void __llvm_profile_reset_counters();17 18void a() {}19void b() {}20void unused() { exit(1); }21void c() {}22 23int main(int argc, const char *argv[]) {24  if (argc != 2)25    unused();26  a();27  b();28  b();29  c();30  if (*argv[1] == 'y')31    __llvm_profile_reset_counters();32  a();33  c();34  b();35  return 0;36}37 38// CHECK: Temporal Profile Traces (samples=2 seen=2):39// CHECK:   Temporal Profile Trace 0 (weight=1 count=4):40// CHECK:     main41// CHECK:     a42// CHECK:     b43// CHECK:     c44// CHECK:   Temporal Profile Trace 1 (weight=5 count=3):45// CHECK:     a46// CHECK:     c47// CHECK:     b48