File: inline-cs-noprobe.test

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (47 lines) | stat: -rw-r--r-- 1,237 bytes parent folder | download | duplicates (3)
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
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-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]: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;
}