1 # RUN: llc -mtriple=aarch64--- -run-pass=prologepilog -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
3 # AArch64 Branch Target Enforcement treats the BR and BLR indirect branch
4 # instructions differently. The BLR instruction can only target a BTI C
5 # instruction, and the BR instruction can only target a BTI J instruction. We
6 # always start indirectly-called functions with BTI C, so the outliner must not
7 # transform a BLR instruction into a BR instruction.
9 # There is an exception to this: BR X16 and BR X17 can also target a BTI C
10 # instruction. We make of this for general tail-calls (tested elsewhere), but
11 # don't currently make use of this in the outliner.
13 # CHECK-NOT: OUTLINED_FUNCTION_
16 @g = hidden local_unnamed_addr global i32 0, align 4
18 define hidden void @bar(ptr nocapture %f) "branch-target-enforcement" {
27 tracksRegLiveness: true
30 liveins: $x20, $x21, $lr, $x19
34 STRWui renamable $w21, renamable $x20, target-flags(aarch64-pageoff, aarch64-nc) @g :: (store (s32) into @g)
35 BLR renamable $x19, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
37 STRWui renamable $w21, renamable $x20, target-flags(aarch64-pageoff, aarch64-nc) @g :: (store (s32) into @g)
38 BLR renamable $x19, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
40 STRWui killed renamable $w21, killed renamable $x20, target-flags(aarch64-pageoff, aarch64-nc) @g :: (store (s32) into @g)
41 BLR killed renamable $x19, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
43 TCRETURNdi @foo, 0, csr_aarch64_aapcs, implicit $sp