summaryrefslogtreecommitdiff
path: root/bolt/test
diff options
context:
space:
mode:
authorAmir Ayupov <aaupov@fb.com>2022-12-28 20:49:30 -0800
committerAmir Ayupov <aaupov@fb.com>2022-12-28 20:50:20 -0800
commit703d94d8f0142317342dc6684c1b6aa85c105182 (patch)
treeb75208e009544a6b35f142b27355f304d7468d2e /bolt/test
parent79d6e9c7130c1b55da188413e9f59e8605fe0902 (diff)
downloadllvm-703d94d8f0142317342dc6684c1b6aa85c105182.tar.gz
[BOLT] Respect -function-order in lite mode
Process functions listed in -function-order file even in lite mode. Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D140435
Diffstat (limited to 'bolt/test')
-rw-r--r--bolt/test/X86/Inputs/order-lite.txt1
-rw-r--r--bolt/test/X86/function-order-lite.s35
2 files changed, 36 insertions, 0 deletions
diff --git a/bolt/test/X86/Inputs/order-lite.txt b/bolt/test/X86/Inputs/order-lite.txt
new file mode 100644
index 000000000000..ba2906d0666c
--- /dev/null
+++ b/bolt/test/X86/Inputs/order-lite.txt
@@ -0,0 +1 @@
+main
diff --git a/bolt/test/X86/function-order-lite.s b/bolt/test/X86/function-order-lite.s
new file mode 100644
index 000000000000..05af73da7815
--- /dev/null
+++ b/bolt/test/X86/function-order-lite.s
@@ -0,0 +1,35 @@
+# Check that functions listed in -function-order list take precedence over
+# lite mode function filtering.
+
+# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
+# RUN: link_fdata %s %t.o %t.fdata
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: llvm-bolt %t.exe --data %t.fdata --lite --reorder-functions=user \
+# RUN: --function-order=%p/Inputs/order-lite.txt -o %t -print-all 2>&1 \
+# RUN: | FileCheck %s
+
+# CHECK: 1 out of 2 functions in the binary (50.0%) have non-empty execution profile
+# CHECK: Binary Function "main" after reorder-functions
+
+ .globl main
+ .type main, %function
+main:
+ .cfi_startproc
+.LBB06:
+ callq testfunc
+ retq
+ .cfi_endproc
+.size main, .-main
+
+ .globl testfunc
+ .type testfunc, %function
+testfunc:
+# FDATA: 0 [unknown] 0 1 testfunc 0 1 0
+ .cfi_startproc
+ pushq %rbp
+ movq %rsp, %rbp
+ movl $0x0, %eax
+ popq %rbp
+ retq
+ .cfi_endproc
+.size testfunc, .-testfunc