File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/**
22 * Test for asm-dump functionality.
33 *
4- * REQUIRES: system -linux,bolt-runtime
4+ * REQUIRES: x86_64 -linux,bolt-runtime
55 *
66 * Compile the source
77 * RUN: %clang -fPIC %s -o %t.exe -Wl,-q
88 *
99 * Profile collection: instrument the binary
10- * RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata -o %t.instr
10+ * RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata -o \
11+ * RUN: %t.instr
1112 *
1213 * Profile collection: run instrumented binary (and capture output)
1314 * RUN: %t.instr > %t.result
Original file line number Diff line number Diff line change 44# internal calls) might create new blocks without a mapping to an
55# input block.
66
7- # REQUIRES: system -linux,bolt-runtime
7+ # REQUIRES: x86_64 -linux,bolt-runtime
88
99# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
1010# Delete our BB symbols so BOLT doesn't mark them as entry points
Original file line number Diff line number Diff line change 11# This reproduces a bug with instrumentation crashes on internal call
22
3- # REQUIRES: system -linux,bolt-runtime
3+ # REQUIRES: x86_64 -linux,bolt-runtime
44
55# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
66# Delete our BB symbols so BOLT doesn't mark them as entry points
Original file line number Diff line number Diff line change 1+ .globl main
2+ .type main , %function
3+ main:
4+ sub sp , sp , # 16
5+ mov w0 , wzr
6+ str wzr , [ sp , # 12 ]
7+ add sp , sp , # 16
8+ ret
9+ .size main , . - main
Original file line number Diff line number Diff line change 1+ # Try to instrument a very fast test. Input bin will not execute any code during
2+ # runtime besides returning zero in main, so it is a good trivial case.
3+ REQUIRES: system-linux,bolt-runtime
4+
5+ RUN: %clang %p/Inputs/basic-instrumentation.s -Wl,-q -o %t.exe
6+ RUN: llvm-bolt %t.exe -o %t --instrument \
7+ RUN: --instrumentation-file=%t \
8+ RUN: --instrumentation-file-append-pid
9+
10+ # Execute program to collect profile
11+ RUN: rm %t.*.fdata || echo Nothing to remove
12+ RUN: %t
13+
14+ # Profile should be written to %t.PID.fdata, check it
15+ RUN: mv %t.*.fdata %t.fdata
16+ RUN: cat %t.fdata | FileCheck -check-prefix=CHECK %s
17+
18+ # Check BOLT works with this profile
19+ RUN: llvm-bolt %t.exe --data %t.fdata -o %t.2 --reorder-blocks=cache
20+
21+ # The instrumented profile should at least say main was called once
22+ CHECK: main 0 0 1{{$}}
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+
3+ typedef int (* func_ptr )(int , int );
4+
5+ int add (int a , int b ) { return a + b ; }
6+
7+ int main () {
8+ func_ptr fun ;
9+ fun = add ;
10+ int sum = fun (10 , 20 ); // indirect call to 'add'
11+ printf ("The sum is: %d\n" , sum );
12+ return 0 ;
13+ }
14+ /*
15+ REQUIRES: system-linux,bolt-runtime
16+
17+ RUN: %clang %cflags %s -o %t.exe -Wl,-q -nopie -fpie
18+
19+ RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata \
20+ RUN: -o %t.instrumented
21+
22+ # Instrumented program needs to finish returning zero
23+ RUN: %t.instrumented | FileCheck %s -check-prefix=CHECK-OUTPUT
24+
25+ # Test that the instrumented data makes sense
26+ RUN: llvm-bolt %t.exe -o %t.bolted --data %t.fdata \
27+ RUN: --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \
28+ RUN: --print-only=main --print-finalized | FileCheck %s
29+
30+ RUN: %t.bolted | FileCheck %s -check-prefix=CHECK-OUTPUT
31+
32+ CHECK-OUTPUT: The sum is: 30
33+
34+ # Check that our indirect call has 1 hit recorded in the fdata file and that
35+ # this was processed correctly by BOLT
36+ CHECK: blr x8 # CallProfile: 1 (0 misses) :
37+ CHECK-NEXT: { add: 1 (0 misses) }
38+ */
Original file line number Diff line number Diff line change 11# Meta test using merge-fdata binary
22UNSUPPORTED: asan
33# Instrumentation currently only works on X86
4- REQUIRES: x86_64-linux, bolt-runtime
4+ REQUIRES: bolt-runtime
55
66# Instrumentation, should test:
77# - Direct branches
You can’t perform that action at this time.
0 commit comments