74 lines · plain
1# Checking that after reordering BasicBlocks, the generated OpNegateRAState instructions2# are placed where the RA state is different between two consecutive instructions.3# This case demonstrates, that the input might have a different amount than the output:4# input has 4, but output only has 3.5 6# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o7# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q8# RUN: llvm-bolt %t.exe -o %t.exe.bolt --no-threads --reorder-blocks=reverse \9# RUN: --print-cfg --print-after-lowering --print-only foo | FileCheck %s10 11# Check that the reordering succeeded.12# CHECK: Binary Function "foo" after building cfg {13# CHECK: BB Layout : .LBB00, .Ltmp2, .Ltmp0, .Ltmp114# CHECK: Binary Function "foo" after inst-lowering {15# CHECK: BB Layout : .LBB00, .Ltmp1, .Ltmp0, .Ltmp216 17 18# Check the generated CFIs.19# CHECK: OpNegateRAState20# CHECK-NEXT: mov x2, #0x621 22# CHECK: autiasp23# CHECK-NEXT: OpNegateRAState24# CHECK-NEXT: ret25 26# CHECK: paciasp27# CHECK-NEXT: OpNegateRAState28 29# CHECK: DWARF CFI Instructions:30# CHECK-NEXT: 0: OpNegateRAState31# CHECK-NEXT: 1: OpNegateRAState32# CHECK-NEXT: 2: OpNegateRAState33# CHECK-NEXT: End of Function "foo"34 35 .text36 .globl foo37 .p2align 238 .type foo,@function39foo:40 .cfi_startproc41 // RA is unsigned42 mov x1, #043 mov x1, #144 mov x1, #245 // jump into the signed "range"46 b .Lmiddle47.Lback:48// sign RA49 paciasp50 .cfi_negate_ra_state51 mov x2, #352 mov x2, #453 // skip unsigned instructions54 b .Lcont55 .cfi_negate_ra_state56.Lmiddle:57// RA is unsigned58 mov x4, #559 b .Lback60 .cfi_negate_ra_state61.Lcont:62// continue in signed state63 mov x2, #664 autiasp65 .cfi_negate_ra_state66 ret67 .cfi_endproc68 .size foo, .-foo69 70 .global _start71 .type _start, %function72_start:73 b foo74