Skip to content

Commit 4d1140d

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.4
1 parent 54aa16d commit 4d1140d

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
3+
int bar(int x, int y) {
4+
if (x % 3) {
5+
return x - y;
6+
}
7+
return x + y;
8+
}
9+
10+
void foo() {
11+
int s, i = 0;
12+
while (i++ < 4000 * 4000)
13+
if (i % 91) s = bar(i, s); else s += 30;
14+
printf("sum is %d\n", s);
15+
}
16+
17+
int main() {
18+
foo();
19+
return 0;
20+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## This test checks if pseudo probes are present in split fragments
2+
RUN: %clang %cflags %p/Inputs/pseudo-probe-split-func.c -o %t \
3+
RUN: -O3 -fuse-ld=lld -fpseudo-probe-for-profiling -fno-omit-frame-pointer \
4+
RUN: -mno-omit-leaf-frame-pointer -g -Wl,-q
5+
## Test pseudo probe encoding when hot fragments are emitted before cold
6+
RUN: llvm-bolt %t -o %t.out -split-functions --split-strategy=all -lite=0
7+
RUN: llvm-profgen --binary=%t.out --perfscript=1 --output=%t.null \
8+
RUN: --show-disassembly-only --show-pseudo-probe | FileCheck %s
9+
## Test pseudo probe encoding when cold fragments are emitted before hot
10+
RUN: llvm-bolt %t -o %t.cold -split-functions --split-strategy=all -lite=0 \
11+
RUN: --hot-functions-at-end
12+
RUN: llvm-profgen --binary=%t.cold --perfscript=1 --output=%t.null \
13+
RUN: --show-disassembly-only --show-pseudo-probe | FileCheck %s
14+
CHECK: Disassembly of section .text.cold.3
15+
CHECK: <foo.cold.3>:
16+
CHECK: [Probe]: FUNC: foo Index: 8 Type: Block
17+
CHECK: <main.cold.3>:
18+
CHECK: [Probe]: FUNC: foo Index: 8 Type: Block Inlined: @ main:2

0 commit comments

Comments
 (0)