blob: 5f8d89f7ba8e72f1511fd785d51e4522f710d4d7 [file] [log] [blame]
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --skip-symbolization --profile-summary-cold-count=0
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --profile-summary-cold-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0
; RUN: FileCheck %s --input-file %t
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --profile-summary-cold-count=0 --ignore-stack-samples --csspgo-preinliner=0 --gen-cs-nested-profile=0
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-STRIP-CTX
; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --profile-summary-cold-count=0 --populate-profile-symbol-list=1 --csspgo-preinliner=0 --gen-cs-nested-profile=0
; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST
; CHECK-SYM-LIST: Dump profile symbol list
; CHECK-SYM-LIST: bar
; CHECK-SYM-LIST: foo
; CHECK-SYM-LIST: main
; CHECK:[main:1 @ foo]:309:0
; CHECK: 2.1: 14
; CHECK: 3: 15
; CHECK: 3.1: 14 bar:14
; CHECK: 3.2: 1
; CHECK: 65526: 14
; CHECK:[main:1 @ foo:3.1 @ bar]:84:0
; CHECK: 1: 14
; CHECK-UNWINDER: [main:1 @ foo]
; CHECK-UNWINDER: 4
; CHECK-UNWINDER: 670-6ad:1
; CHECK-UNWINDER: 67e-69b:1
; CHECK-UNWINDER: 67e-6ad:13
; CHECK-UNWINDER: 6bd-6c8:14
; CHECK-UNWINDER: 2
; CHECK-UNWINDER: 69b->670:1
; CHECK-UNWINDER: 6c8->67e:15
; CHECK-UNWINDER: [main:1 @ foo:3.1 @ bar]
; CHECK-UNWINDER: 1
; CHECK-UNWINDER: 6af-6bb:14
; CHECK-UNWINDER: 0
; CHECK-STRIP-CTX: main:1109:0
; CHECK-STRIP-CTX: 0: 0
; CHECK-STRIP-CTX: 2: 0
; CHECK-STRIP-CTX: 1: foo:1109
; CHECK-STRIP-CTX: 2.1: 14
; CHECK-STRIP-CTX: 3: 15
; CHECK-STRIP-CTX: 3.2: 1
; CHECK-STRIP-CTX: 4: 0
; CHECK-STRIP-CTX: 7: 0
; CHECK-STRIP-CTX: 65526: 14
; CHECK-STRIP-CTX: 3.1: bar:196
; CHECK-STRIP-CTX: 1: 14
; original code:
; clang -O3 -g test.c -o a.out
#include <stdio.h>
int bar(int x, int y) {
if (x % 3) {
return x - y;
}
return x + y;
}
void foo() {
int s, i = 0;
while (i++ < 4000 * 4000)
if (i % 91) s = bar(i, s); else s += 30;
printf("sum is %d\n", s);
}
int main() {
foo();
return 0;
}