1 # Test the double jump removal peephole.
3 # This test has commands that rely on shell capabilities that won't execute
4 # correctly on Windows e.g. subshell execution
7 RUN: %clang %cflags %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
12 CHECK: BOLT-INFO: Peephole: 1 double jumps patched.
15 CHECK-NEXT: pushq %rbp
16 CHECK-NEXT: movq %rsp, %rbp
17 CHECK-NEXT: movq %rdi, -0x8(%rbp)
18 CHECK-NEXT: cmpq $0x1, -0x8(%rbp)
19 CHECK-NEXT: je {{.*}} <_Z3foom+0x2c>
20 CHECK-NEXT: incq -0x8(%rbp)
21 CHECK-NEXT: incq -0x8(%rbp)
22 CHECK-NEXT: cmpq $0x2, -0x8(%rbp)
23 CHECK-NEXT: je {{.*}} <_Z3foom+0x22>
24 CHECK-NEXT: incq -0x8(%rbp)
25 CHECK-NEXT: movq -0x8(%rbp), %rdi
27 CHECK-NEXT: jmp {{.*}} <bar>
29 CHECK-NEXT: incq -0x8(%rbp)
30 CHECK-NEXT: jmp {{.*}} <bar>