brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · f1707a6 Raw
49 lines · plain
1; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noinline-cs-pseudoprobe.perfscript --binary=%S/Inputs/noinline-cs-pseudoprobe.perfbin --output=%t1 --ignore-stack-samples2; RUN: FileCheck %s --input-file %t13; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noinline-cs-pseudoprobe.aggperfscript --binary=%S/Inputs/noinline-cs-pseudoprobe.perfbin --output=%t2 --ignore-stack-samples4; RUN: FileCheck %s --input-file %t25 6 7; CHECK:     foo:75:08; CHECK-NEXT:  1: 09; CHECK-NEXT:  2: 1510; CHECK-NEXT:  3: 1511; CHECK-NEXT:  4: 1512; CHECK-NEXT:  5: 013; CHECK-NEXT:  6: 1514; CHECK-NEXT:  7: 015; CHECK-NEXT:  8: 15 bar:1516; CHECK-NEXT:  9: 017; CHECK-NEXT:  !CFGChecksum: 56308890401323618; CHECK-NEXT: bar:30:1519; CHECK-NEXT:  1: 1520; CHECK-NEXT:  4: 1521; CHECK-NEXT:  !CFGChecksum: 7261722075622 23 24 25; clang -O3 -fuse-ld=lld -fpseudo-probe-for-profiling26; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls27; -fno-inline-functions -g test.c  -o a.out28 29#include <stdio.h>30 31int bar(int x, int y) {32  if (x % 3) {33    return x - y;34  }35  return x + y;36}37 38void foo() {39  int s, i = 0;40  while (i++ < 4000 * 4000)41    if (i % 91) s = bar(i, s); else s += 30;42  printf("sum is %d\n", s);43}44 45int main() {46  foo();47  return 0;48}49