46 lines · plain
1; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t12; RUN: FileCheck %s --input-file %t1 --check-prefix=CALLSITE3; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t2 --update-total-samples=14; RUN: FileCheck %s --input-file %t2 --check-prefix=TOTAL5 6 7;CALLSITE: foo:1241:08;CALLSITE: 0: 09;CALLSITE: 1: 010;CALLSITE: 2: 1911;CALLSITE: 3: 21 bar:2112;CALLSITE: 4: 013;CALLSITE: 5: 014 15;TOTAL: foo:40:016;TOTAL: 0: 017;TOTAL: 1: 018;TOTAL: 2: 1919;TOTAL: 3: 21 bar:2120;TOTAL: 4: 021;TOTAL: 5: 022 23 24; original code:25; clang -O3 -g -fdebug-info-for-profiling test.c -fno-inline -o a.out26#include <stdio.h>27 28int bar(int x, int y) {29 if (x % 3) {30 return x - y;31 }32 return x + y;33}34 35void foo() {36 int s, i = 0;37 while (i++ < 4000 * 4000)38 if (i % 91) s = bar(i, s); else s += 30;39 printf("sum is %d\n", s);40}41 42int main() {43 foo();44 return 0;45}46