forked from OSchip/llvm-project
[TESTS] Re-add issue20/issue26 tests
Summary: Re-add tests removed because they used to depend on yaml2obj. Rewrite them with an assembler (llvm-mc) and use the system linker to produce a valid ELF as input to BOLT. (cherry picked from FBD22323449)
This commit is contained in:
parent
41cb6b68ed
commit
26ad0bd951
|
@ -0,0 +1,53 @@
|
|||
# This reproduces issue 20 from our github repo
|
||||
# "BOLT crashes when removing unreachable BBs that are a target
|
||||
# in a JT"
|
||||
|
||||
# REQUIRES: system-linux
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
|
||||
# RUN: %s -o %t.o
|
||||
# RUN: %host_cc %t.o -o %t.exe
|
||||
# RUN: llvm-bolt %t.exe -relocs=0 -jump-tables=move -print-finalized \
|
||||
# RUN: -o %t.out | FileCheck %s
|
||||
|
||||
# CHECK: BOLT-INFO: UCE removed 0 blocks and 0 bytes of code.
|
||||
# CHECK: Binary Function "main"
|
||||
# CHECK: .LFT{{.*}} (2 instructions, align : 1)
|
||||
# CHECK-NEXT: CFI State : 0
|
||||
# CHECK-NEXT: 00000004: andq
|
||||
# CHECK-NEXT: 00000008: jmpq
|
||||
# CHECK-NEXT: Successors: .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}
|
||||
|
||||
|
||||
.text
|
||||
.globl main
|
||||
.type main, %function
|
||||
.size main, .Lend1-main
|
||||
main:
|
||||
xorq %rax, %rax
|
||||
retq
|
||||
andq $3, %rdi
|
||||
jmpq *jumptbl(,%rdi,8)
|
||||
|
||||
.Lbb1:
|
||||
movl $0x1, %eax
|
||||
jmp .Lexit
|
||||
.Lbb2:
|
||||
movl $0x2, %eax
|
||||
jmp .Lexit
|
||||
.Lbb3:
|
||||
movl $0x3, %eax
|
||||
jmp .Lexit
|
||||
.Lbb4:
|
||||
movl $0x4, %eax
|
||||
.Lexit:
|
||||
retq
|
||||
.Lend1:
|
||||
|
||||
.section .rodata
|
||||
.globl jumptbl
|
||||
jumptbl:
|
||||
.quad .Lbb1
|
||||
.quad .Lbb2
|
||||
.quad .Lbb3
|
||||
.quad .Lbb4
|
|
@ -0,0 +1,56 @@
|
|||
# This reproduces issue 26 from our github repo
|
||||
# BOLT fails with the following assertion:
|
||||
# llvm/tools/llvm-bolt/src/BinaryFunction.cpp:2950: void llvm::bolt::BinaryFunction::postProcessBranches(): Assertion `validateCFG() && "invalid CFG"' failed.
|
||||
|
||||
# REQUIRES: system-linux
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
|
||||
# RUN: %s -o %t.o
|
||||
# RUN: %host_cc %t.o -o %t.exe -Wl,-q
|
||||
# RUN: llvm-bolt %t.exe -relocs -print-cfg -o %t.out \
|
||||
# RUN: | FileCheck %s
|
||||
|
||||
# CHECK-NOT: BOLT-WARNING: CFG invalid in XYZ @ .LBB0
|
||||
|
||||
# CHECK: Binary Function "XYZ"
|
||||
|
||||
# CHECK: .Ltmp{{.*}} (1 instructions, align : 1)
|
||||
# CHECK-NEXT: Secondary Entry Point: FUNCat{{.*}}
|
||||
|
||||
.text
|
||||
.globl XYZ
|
||||
.type XYZ, %function
|
||||
.size XYZ, .Lend1-XYZ
|
||||
XYZ:
|
||||
movl %fs:-0x350, %eax
|
||||
cmpl %eax, %edi
|
||||
jne .L1
|
||||
|
||||
cmp %rdx, (%rsi)
|
||||
jne .L2
|
||||
|
||||
movq %rcx, (%rsi)
|
||||
.L1:
|
||||
retq
|
||||
|
||||
.L2:
|
||||
movl $0xffffffff, %eax
|
||||
retq
|
||||
.Lend1:
|
||||
|
||||
.globl FUNC
|
||||
.type FUNC, %function
|
||||
.size FUNC, .Lend - FUNC
|
||||
FUNC:
|
||||
cmpq %rdi, %rsi
|
||||
je .L1
|
||||
retq
|
||||
.Lend:
|
||||
|
||||
.globl main
|
||||
.type main, %function
|
||||
.size main, .Lend2 - main
|
||||
main:
|
||||
xorq %rax, %rax
|
||||
retq
|
||||
.Lend2:
|
|
@ -7,7 +7,7 @@
|
|||
# blarge is the binary for "basicmath large inputs" taken from Mibench.
|
||||
|
||||
# Currently failing in MacOS / generating different hash for usqrt
|
||||
REQUIRES: Linux
|
||||
REQUIRES: system-linux
|
||||
|
||||
RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
|
||||
RUN: perf2bolt %t.exe -o %t -pa -p %p/Inputs/pre-aggregated.txt -w %t.new
|
||||
|
|
Loading…
Reference in New Issue