1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/tools/llvm-profgen/cs-interrupt.test
Hongtao Yu f2d99918a7 [CSSPGO][llvm-profgen] Ignore LBR records after interrupt transition
If we have seen an inwards transition from external code to internal code, but not a following outwards transition, the inwards transition is likely due to interrupt which is usually unpaired. Ignore current  and subsequent entries since they are likely from an unrelated pre-interrupt context.

LBR records from different interrupt context are unrelated and they should not be mixed together. Currenlty the OS does this for task-scheduling interrupt but not for all interrupts.

Reviewed By: wenlei, wlei

Differential Revision: https://reviews.llvm.org/D104276
2021-06-18 12:13:53 -07:00

57 lines
1.4 KiB
Plaintext

; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/cs-interrupt.perfscript --binary=%S/Inputs/noinline-cs-noprobe.perfbin --output=%t --show-unwinder-output --profile-summary-cold-count=0 | FileCheck %s --check-prefix=CHECK-UNWINDER
; RUN: FileCheck %s --input-file %t
; CHECK:[main:1 @ foo]:88:0
; CHECK: 2: 5
; CHECK: 3: 5 bar:5
; CHECK:[main:1 @ foo:3 @ bar]:74:5
; CHECK: 0: 5
; CHECK: 1: 5
; CHECK: 2: 3
; CHECK: 5: 4
; CHECK-UNWINDER: Binary(noinline-cs-noprobe.perfbin)'s Range Counter:
; CHECK-UNWINDER: main:1 @ foo
; CHECK-UNWINDER: (5ff, 62f): 5
; CHECK-UNWINDER: (634, 637): 4
; CHECK-UNWINDER: (645, 645): 5
; CHECK-UNWINDER: main:1 @ foo:3 @ bar
; CHECK-UNWINDER: (5b0, 5c8): 2
; CHECK-UNWINDER: (5b0, 5d7): 3
; CHECK-UNWINDER: (5e5, 5e9): 4
; CHECK-UNWINDER: Binary(noinline-cs-noprobe.perfbin)'s Branch Counter:
; CHECK-UNWINDER: main:1 @ foo
; CHECK-UNWINDER: (62f, 5b0): 5
; CHECK-UNWINDER: (637, 645): 5
; CHECK-UNWINDER: (645, 5ff): 5
; CHECK-UNWINDER: main:1 @ foo:3 @ bar
; CHECK-UNWINDER: (5c8, 5dc): 2
; CHECK-UNWINDER: (5d7, 5e5): 4
; CHECK-UNWINDER: (5e9, 634): 4
; original code:
; clang -O0 -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;
}