1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/tools/llvm-profgen/inline-cs-noprobe.test
wlei be4f05ba0b [CSSPGO][llvm-profgen] Filter out the instructions without location info for symbolizer
It appears some instructions doesn't have the debug location info and the symbolizer will return an empty call stack for them which will cause some crash later in profile unwinding. Actually we do not record the sample info for them, so this change just filter out those instruction.

As those instruction would appears at the begin and end of the instruction list, without them we need to add the boundary check for IP `advance` and `backward`.

Also for pseudo probe based profile, we actually don't need the symbolized location info, so here just change to use an empty stack for it. This could save half of the binary loading time.

Differential Revision: https://reviews.llvm.org/D96434
2021-02-12 16:47:49 -08:00

48 lines
1.2 KiB
Plaintext

; RUN: llvm-profgen --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --show-unwinder-output --csprof-cold-thres=0 | FileCheck %s --check-prefix=CHECK-UNWINDER
; RUN: FileCheck %s --input-file %t
; CHECK:[main:1 @ foo]:309:0
; CHECK: 2.1: 14
; CHECK: 3: 15
; CHECK: 3.1: 14 bar:14
; CHECK: 3.2: 1
; CHECK:[main:1 @ foo:3.1 @ bar]:84:0
; CHECK: 1: 14
; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Range Counter:
; CHECK-UNWINDER: main:1 @ foo
; CHECK-UNWINDER: (670, 6ad): 1
; CHECK-UNWINDER: (67e, 69b): 1
; CHECK-UNWINDER: (67e, 6ad): 13
; CHECK-UNWINDER: (6bd, 6c8): 14
; CHECK-UNWINDER: main:1 @ foo:3.1 @ bar
; CHECK-UNWINDER: (6af, 6bb): 14
; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Branch Counter:
; CHECK-UNWINDER: main:1 @ foo
; CHECK-UNWINDER: (69b, 670): 1
; CHECK-UNWINDER: (6c8, 67e): 15
; 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;
}