60 lines · plain
1# RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu \2# RUN: -start-before aarch64-sls-hardening \3# RUN: -stop-after aarch64-sls-hardening -o - %s \4# RUN: | FileCheck %s --check-prefixes=CHECK \5# RUN: --implicit-check-not=__llvm_slsblr_thunk_x76# RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu \7# RUN: -start-before aarch64-sls-hardening \8# RUN: -asm-verbose=0 -o - %s \9# RUN: | FileCheck %s --check-prefixes=ASM \10# RUN: --implicit-check-not=__llvm_slsblr_thunk_x711 12# Check that the BLR SLS hardening transforms a BLR into a BL with operands as13# expected.14--- |15 @a = dso_local local_unnamed_addr global i32 (...)* null, align 816 @b = dso_local local_unnamed_addr global i32 0, align 417 18 define dso_local void @fn1() local_unnamed_addr "target-features"="+harden-sls-blr" {19 entry:20 %0 = load i32 ()*, i32 ()** bitcast (i32 (...)** @a to i32 ()**), align 821 %call = tail call i32 %0() nounwind22 store i32 %call, i32* @b, align 423 ret void24 }25...26---27name: fn128tracksRegLiveness: true29body: |30 ; CHECK-LABEL: name: fn131 bb.0.entry:32 liveins: $lr33 34 early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 ; :: (store (s64) into %stack.0)35 frame-setup CFI_INSTRUCTION def_cfa_offset 1636 frame-setup CFI_INSTRUCTION offset $w30, -1637 renamable $x8 = ADRP target-flags(aarch64-page) @a38 renamable $x8 = LDRXui killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @a :: (dereferenceable load (s64) from `i32 ()** bitcast (i32 (...)** @a to i32 ()**)`)39 BLRNoIP killed renamable $x8, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w040 ; CHECK: BL <mcsymbol __llvm_slsblr_thunk_x8>, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0, implicit killed $x841 renamable $x8 = ADRP target-flags(aarch64-page) @b42 STRWui killed renamable $w0, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @b :: (store (s32) into @b)43 early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 ; :: (load (s64) from %stack.0)44 RET undef $lr45 46 47...48 49# CHECK: name: __llvm_slsblr_thunk_x850#51# CHECK: $x16 = ORRXrs $xzr, $x8, 052# CHECK-NEXT: BR $x1653# CHECK-NEXT: SpeculationBarrierISBDSBEndBB54 55# ASM-LABEL: __llvm_slsblr_thunk_x8:56# ASM-NEXT: mov x16, x857# ASM-NEXT: br x1658# ASM-NEXT: dsb sy59# ASM-NEXT: isb60