Skip to content

Commit 4b562f9

Browse files
[BOLT] Remove shell requirements from several tests (#155623)
This patch removes the shell requirement from four tests. This patched is aimed at enabling lit's internal shell for BOLT, which results in a ~15% test time improvement. After this patch there are still two more unresolved tests that need to be fixed. That is tracked by #102693. This is towards #102701.
1 parent 2b24287 commit 4b562f9

File tree

4 files changed

+28
-41
lines changed

4 files changed

+28
-41
lines changed

bolt/test/X86/double-jump.test

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
## Test the double jump removal peephole.
22

3-
## This test has commands that rely on shell capabilities that won't execute
4-
## correctly on Windows e.g. subshell execution
5-
REQUIRES: shell
6-
73
RUN: %clangxx %cxxflags %p/Inputs/double_jump.cpp -o %t.exe
8-
RUN: (llvm-bolt %t.exe --peepholes=double-jumps \
9-
RUN: --eliminate-unreachable -o %t 2>&1 \
10-
RUN: && llvm-objdump -d %t --print-imm-hex --no-show-raw-insn) | FileCheck %s
4+
RUN: llvm-bolt %t.exe --peepholes=double-jumps \
5+
RUN: --eliminate-unreachable -o %t | FileCheck --check-prefix CHECK-BOLT %s
6+
RUN: llvm-objdump -d %t --print-imm-hex --no-show-raw-insn | FileCheck %s
117

12-
CHECK: BOLT-INFO: Peephole: 1 double jumps patched.
8+
CHECK-BOLT: BOLT-INFO: Peephole: 1 double jumps patched.
139

1410
CHECK: <_Z3foom>:
1511
CHECK-NEXT: pushq %rbp

bolt/test/X86/jmp-optimization.test

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
## Tests the optimization of functions that just do a tail call in the beginning.
22

3-
## This test has commands that rely on shell capabilities that won't execute
4-
## correctly on Windows e.g. unsupported parameter expansion
5-
REQUIRES: shell
6-
7-
RUN: %clangxx %cxxflags -O2 %S/Inputs/jmp_opt{,2,3}.cpp -o %t
3+
RUN: %clangxx %cxxflags -O2 %S/Inputs/jmp_opt.cpp %S/Inputs/jmp_opt2.cpp \
4+
RUN: %S/Inputs/jmp_opt3.cpp -o %t
85
RUN: llvm-bolt -inline-small-functions %t -o %t.bolt
96
RUN: llvm-objdump -d %t.bolt --print-imm-hex | FileCheck %s
107

bolt/test/X86/jump-table-icp.test

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,16 @@ RUN: link_fdata %p/Inputs/jump_table_icp.s %t.o %t.fdata --nmtool llvm-nm
44
RUN: llvm-strip --strip-unneeded %t.o
55
RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
66

7-
## This test has commands that rely on shell capabilities that won't execute
8-
## correctly on Windows e.g. subshell execution
9-
REQUIRES: shell
10-
11-
RUN: (llvm-bolt %t.exe --data %t.fdata -o %t --relocs \
7+
RUN: llvm-bolt %t.exe --data %t.fdata -o %t --relocs \
128
RUN: --reorder-blocks=cache --split-functions --split-all-cold \
139
RUN: --use-gnu-stack --dyno-stats --indirect-call-promotion=jump-tables \
1410
RUN: --print-icp -v=0 \
1511
RUN: --enable-bat --print-cache-metrics \
1612
RUN: --icp-jt-remaining-percent-threshold=10 \
1713
RUN: --icp-jt-total-percent-threshold=2 \
1814
RUN: --indirect-call-promotion-topn=1 \
19-
RUN: --icp-jump-tables-targets --align-functions-max-bytes=7 2>&1 && \
20-
RUN: llvm-objdump -d %t --print-imm-hex) | FileCheck %s
15+
RUN: --icp-jump-tables-targets --align-functions-max-bytes=7 | FileCheck %s
16+
RUN: llvm-objdump -d %t --print-imm-hex | FileCheck --check-prefix CHECK-ASM %s
2117

2218
BOLT-INFO: ICP total indirect callsites = 0
2319
BOLT-INFO: ICP total jump table callsites = 2
@@ -107,14 +103,14 @@ CHECK-NEXT: Exec Count : 140
107103
CHECK: Predecessors: .Ltmp{{.*}}, .LFT{{.*}}
108104
CHECK: Successors: .Ltmp{{.*}} (mispreds: 0, count: 98)
109105

110-
CHECK: <_Z3inci>:
111-
CHECK: movq 0x{{.*}}(,%rax,8), %rax
112-
CHECK-NEXT: cmpq $0x{{.*}}, %rax
113-
CHECK-NEXT: je {{.*}} <_Z3inci+0x{{.*}}>
114-
CHECK-NEXT: jmpq *%rax
115-
116-
CHECK: <_Z7inc_dupi>:
117-
CHECK: movq 0x{{.*}}(,%rax,8), %rax
118-
CHECK-NEXT: cmpq $0x{{.*}}, %rax
119-
CHECK-NEXT: je {{.*}} <_Z7inc_dupi+0x{{.*}}>
120-
CHECK-NEXT: jmpq *%rax
106+
CHECK-ASM: <_Z3inci>:
107+
CHECK-ASM: movq 0x{{.*}}(,%rax,8), %rax
108+
CHECK-ASM-NEXT: cmpq $0x{{.*}}, %rax
109+
CHECK-ASM-NEXT: je {{.*}} <_Z3inci+0x{{.*}}>
110+
CHECK-ASM-NEXT: jmpq *%rax
111+
112+
CHECK-ASM: <_Z7inc_dupi>:
113+
CHECK-ASM: movq 0x{{.*}}(,%rax,8), %rax
114+
CHECK-ASM-NEXT: cmpq $0x{{.*}}, %rax
115+
CHECK-ASM-NEXT: je {{.*}} <_Z7inc_dupi+0x{{.*}}>
116+
CHECK-ASM-NEXT: jmpq *%rax

bolt/test/X86/shrinkwrapping.test

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22
## shrink-wrapping when optimizing a function without
33
## frame pointers.
44

5-
## This test has commands that rely on shell capabilities that won't execute
6-
## correctly on Windows e.g. subshell execution to capture command output.
7-
REQUIRES: shell
8-
95
RUN: %clangxx %cxxflags -no-pie %S/Inputs/exc4sw.S -o %t.exe -Wl,-q
106
RUN: llvm-bolt %t.exe -o %t --relocs --frame-opt=all \
117
RUN: --print-only=main --print-cfg \
128
RUN: --data=%p/Inputs/exc4sw.fdata --reorder-blocks=cache 2>&1 | \
139
RUN: FileCheck %s --check-prefix=CHECK-BOLT
1410

15-
RUN: llvm-objdump --dwarf=frames %t.exe | grep -A20 -e \
16-
RUN: `llvm-nm --numeric-sort %t.exe | grep main | tail -n 1 | \
17-
RUN: cut -f1 -d' ' | tail -c9` 2>&1 | FileCheck %s --check-prefix=CHECK-INPUT
11+
RUN: llvm-nm --numeric-sort %t.exe | grep main | tail -n 1 | \
12+
RUN: cut -f1 -d' ' | tail -c9 > %t.input_address
13+
RUN: llvm-objdump --dwarf=frames %t.exe | grep -A20 -f %t.input_address \
14+
RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-INPUT
1815

19-
RUN: llvm-objdump --dwarf=frames %t | grep -A20 -e \
20-
RUN: `llvm-nm --numeric-sort %t | grep main | tail -n 1 | cut -f1 -d' ' | \
21-
RUN: tail -c9` 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUT
16+
RUN: llvm-nm --numeric-sort %t | grep main | tail -n 1 | \
17+
RUN: cut -f1 -d' ' | tail -c9 > %t.output_address
18+
RUN: llvm-objdump --dwarf=frames %t | grep -A20 -f %t.output_address \
19+
RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUT
2220

2321
CHECK-BOLT: Extern Entry Count: 100
2422
CHECK-BOLT: Shrink wrapping moved 2 spills inserting load/stores and 0 spills inserting push/pops

0 commit comments

Comments
 (0)