40 lines · plain
1; RUN: llvm-profgen --format=text --ignore-stack-samples --use-dwarf-correlation --perfscript=%S/Inputs/inline-cs-pseudoprobe.perfscript --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --profile-summary-cold-count=02; RUN: FileCheck %s --input-file %t3 4; CHECK: main:1109:05; CHECK-NEXT: 0: 06; CHECK-NEXT: 2: 07; CHECK-NEXT: 1: foo:11098; CHECK-NEXT: 2: 149; CHECK-NEXT: 3: 1510; CHECK-NEXT: 4: 011; CHECK-NEXT: 65525: 1412; CHECK-NEXT: 3: bar:19613; CHECK-NEXT: 1: 1414 15 16; clang -O3 -fuse-ld=lld -fpseudo-probe-for-profiling17; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls18; -g test.c -o a.out19 20#include <stdio.h>21 22int bar(int x, int y) {23 if (x % 3) {24 return x - y;25 }26 return x + y;27}28 29void foo() {30 int s, i = 0;31 while (i++ < 4000 * 4000)32 if (i % 91) s = bar(i, s); else s += 30;33 printf("sum is %d\n", s);34}35 36int main() {37 foo();38 return 0;39}40