53 lines · plain
1## This reproduces issue 20 from our github repo2## "BOLT crashes when removing unreachable BBs that are a target3## in a JT"4 5# REQUIRES: system-linux6 7# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \8# RUN: %s -o %t.o9# RUN: %clang %cflags -no-pie %t.o -o %t.exe10# RUN: llvm-bolt %t.exe --relocs=0 --jump-tables=move --print-finalized \11# RUN: -o %t.out | FileCheck %s12 13# CHECK-NOT: BOLT-INFO: UCE removed {{.*}} blocks and {{.*}} bytes of code14# CHECK: Binary Function "main"15# CHECK: .LFT{{.*}} (2 instructions, align : 1)16# CHECK-NEXT: 00000004: andq17# CHECK-NEXT: 00000008: jmpq18# CHECK-NEXT: Successors: .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}19 20 21 .text22 .globl main23 .type main, %function24 .size main, .Lend1-main25main:26 xorq %rax, %rax27 retq28 andq $3, %rdi29 jmpq *jumptbl(,%rdi,8)30 31.Lbb1:32 movl $0x1, %eax33 jmp .Lexit34.Lbb2:35 movl $0x2, %eax36 jmp .Lexit37.Lbb3:38 movl $0x3, %eax39 jmp .Lexit40.Lbb4:41 movl $0x4, %eax42.Lexit:43 retq44.Lend1:45 46 .section .rodata47 .globl jumptbl48jumptbl:49 .quad .Lbb150 .quad .Lbb251 .quad .Lbb352 .quad .Lbb453