[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
[llvm-project.git] / bolt / test / runtime / X86 / user-func-reorder.c
blobfcb92bca16259b4d4957172c39885b77c8b2d1d2
1 /* Checks that BOLT correctly processes a user-provided function list file,
2 * reorder functions according to this list, update hot_start and hot_end
3 * symbols and insert a function to perform hot text mapping during program
4 * startup.
5 */
6 #include <stdio.h>
8 int foo(int x) {
9 return x + 1;
12 int fib(int x) {
13 if (x < 2)
14 return x;
15 return fib(x - 1) + fib(x - 2);
18 int bar(int x) {
19 return x - 1;
22 int main(int argc, char **argv) {
23 printf("fib(%d) = %d\n", argc, fib(argc));
24 return 0;
28 REQUIRES: system-linux,bolt-runtime
30 RUN: %clang %cflags -no-pie %s -o %t.exe -Wl,-q
32 RUN: llvm-bolt %t.exe --relocs=1 --lite --reorder-functions=user \
33 RUN: --hugify --function-order=%p/Inputs/user_func_order.txt -o %t
34 RUN: llvm-nm --numeric-sort --print-armap %t | \
35 RUN: FileCheck %s -check-prefix=CHECK-NM
36 RUN: %t 1 2 3 | FileCheck %s -check-prefix=CHECK-OUTPUT
38 CHECK-NM: W __hot_start
39 CHECK-NM: T main
40 CHECK-NM-NEXT: T fib
41 CHECK-NM-NEXT: W __hot_end
43 CHECK-OUTPUT: fib(4) = 3