70 lines · plain
1; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/func-split.perfscript --binary=%S/Inputs/func-split.perfbin --output=%t --gen-cs-nested-profile=02; RUN: FileCheck %s --input-file %t --check-prefix=CHECK3; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/func-split.perfscript --binary=%S/Inputs/func-split.perfbin --output=%t --ignore-stack-samples --gen-cs-nested-profile=04; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-STRIP-CTX5 6;CHECK: [foo]:409:07;CHECK: 2.1: 278;CHECK: 3: 279;CHECK: 3.1: 2 bar:210;CHECK: 3.2: 2611;CHECK: [foo:3.1 @ bar]:8:012;CHECK: 1: 113;CHECK: 5: 114;CHECK: [bar]:0:115 16;CHECK-NOT: foo.cold17 18;CHECK-STRIP-CTX: foo:1334:019;CHECK-STRIP-CTX: 0: 020;CHECK-STRIP-CTX: 2.1: 2721;CHECK-STRIP-CTX: 3: 2722;CHECK-STRIP-CTX: 3.1: 1 bar:123;CHECK-STRIP-CTX: 3.2: 2624;CHECK-STRIP-CTX: 4: 025;CHECK-STRIP-CTX: bar:27:126;CHECK-STRIP-CTX: 1: 127;CHECK-STRIP-CTX: 5: 128 29;CHECK-STRIP-CTX-NOT: foo.cold30 31 32; clang -g -O3 -fdebug-info-for-profiling func-split.c -mllvm -mfs-count-threshold=033; -fprofile-sample-use=profile.txt -fno-inline -mllvm --enable-split-machine-functions=134 35#include <stdio.h>36 37int bar(int x, int y) {38 if (x % 3) {39 return x - y;40 }41 return x + y;42}43 44void foo() {45 int s, i = 0;46 while (i++ < 4000 * 4000)47 if (i % 91 == 0) s = bar(i, s); else s += 30;48 printf("sum is %d\n", s);49}50 51int main() {52 foo();53 return 0;54}55 56; profile.txt:57 58foo:106269:059 2.1: 226860 2.2: 221761 3: 226862 3.1: 1 bar:163 3.2: 219264bar:1032:165 0: 2466 1: 2467 2: 1668 4: 869 5: 2470