1; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/func-split.perfscript --binary=%S/Inputs/func-split.perfbin --output=%t --gen-cs-nested-profile=0 2; RUN: FileCheck %s --input-file %t --check-prefix=CHECK 3; 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=0 4; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-STRIP-CTX 5 6;CHECK: [foo]:409:0 7;CHECK: 2.1: 27 8;CHECK: 3: 27 9;CHECK: 3.1: 2 bar:2 10;CHECK: 3.2: 26 11;CHECK: [foo:3.1 @ bar]:8:0 12;CHECK: 1: 1 13;CHECK: 5: 1 14;CHECK: [bar]:0:1 15 16;CHECK-NOT: foo.cold 17 18;CHECK-STRIP-CTX: foo:1334:0 19;CHECK-STRIP-CTX: 0: 0 20;CHECK-STRIP-CTX: 2.1: 27 21;CHECK-STRIP-CTX: 3: 27 22;CHECK-STRIP-CTX: 3.1: 1 bar:1 23;CHECK-STRIP-CTX: 3.2: 26 24;CHECK-STRIP-CTX: 4: 0 25;CHECK-STRIP-CTX: bar:27:1 26;CHECK-STRIP-CTX: 1: 1 27;CHECK-STRIP-CTX: 5: 1 28 29;CHECK-STRIP-CTX-NOT: foo.cold 30 31 32; clang -g -O3 -fdebug-info-for-profiling func-split.c -mllvm -mfs-count-threshold=0 33; -fprofile-sample-use=profile.txt -fno-inline -mllvm --enable-split-machine-functions=1 34 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:0 59 2.1: 2268 60 2.2: 2217 61 3: 2268 62 3.1: 1 bar:1 63 3.2: 2192 64bar:1032:1 65 0: 24 66 1: 24 67 2: 16 68 4: 8 69 5: 24 70