1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe-skid.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t --skip-symbolization --leading-ip-only
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe-skid.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t --leading-ip-only
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK
; Here we check the ability to ignore LBRs, which is useful for generating
; profiles where only the precise PMU sample IP is of interest. In general the
; IPs need not identify a branch. In this case there are exactly 4 samples, so
; we see only these 4 locations as "hot" and none of the LBR history.
; Compare with noinline-noprobe.test, which includes LBR history.
; Note that there are two different IPs (5c5 and 5c8) contributing to line
; offset 1 in bar. This tests that sample counts corresponding to the same
; debug location are summed into that location in the profile rather than the
; maximum being taken, as happens with basic block execution count profiles.
;CHECK: bar:14:0
;CHECK: 0: 0
;CHECK: 1: 2
;CHECK: 2: 1
;CHECK: 4: 0
;CHECK: 5: 0
;CHECK: foo:5:0
;CHECK: 0: 0
;CHECK: 1: 0
;CHECK: 2: 0
;CHECK: 3: 1
;CHECK: 4: 0
;CHECK: 5: 0
CHECK-RAW-PROFILE: 4
CHECK-RAW-PROFILE-NEXT: 5c5-5c5:1
CHECK-RAW-PROFILE-NEXT: 5c8-5c8:1
CHECK-RAW-PROFILE-NEXT: 5d7-5d7:1
CHECK-RAW-PROFILE-NEXT: 62f-62f:1
; original code:
; clang -O3 -g -fdebug-info-for-profiling test.c -fno-inline -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;
}
|