1 # Test BOLT does not crash by trying to change the direction of a JRCXZ
3 # REQUIRES: system-linux
5 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
7 # RUN: link_fdata %s %t.o %t.fdata
8 # RUN: llvm-strip --strip-unneeded %t.o
9 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
10 # RUN: llvm-bolt %t.exe --relocs=1 --reorder-blocks=ext-tsp --print-finalized \
11 # RUN: -o %t.out --data %t.fdata | FileCheck %s
17 .section .text.startup,"ax",@progbits
26 .type test_function,@function
29 # FDATA: 0 main 0 1 test_function 0 0 510
32 jmpq
*jumptbl
(,%rdi
,8)
34 # Here are the 4 possible targets of the indirect branch to simulate a simple
35 # CFG. What is important here is that BB1, the first block, conditionally
36 # transfers control to the exit block with JRCXZ (.J1). We create a mock profile
37 # saying that this branch is taken more often than not, causing BOLT to try to
38 # put the exit block after it, which would require us to change the direction
44 # FDATA: 1 test_function #.J1# 1 test_function #.BB2# 0 10
45 # FDATA: 1 test_function #.J1# 1 test_function #.BBend# 0 500