• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -mtriple=aarch64--- -run-pass=prologepilog -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
2
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.
8
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.
12
13# CHECK-NOT: OUTLINED_FUNCTION_
14
15--- |
16  @g = hidden local_unnamed_addr global i32 0, align 4
17
18  define hidden void @bar(void ()* nocapture %f) "branch-target-enforcement"="true" {
19  entry:
20    ret void
21  }
22
23  declare void @foo()
24...
25---
26name:            bar
27tracksRegLiveness: true
28body:             |
29  bb.0.entry:
30    liveins: $x20, $x21, $lr, $x19
31
32    HINT 34
33
34    STRWui renamable $w21, renamable $x20, target-flags(aarch64-pageoff, aarch64-nc) @g :: (store 4 into @g)
35    BLR renamable $x19, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
36
37    STRWui renamable $w21, renamable $x20, target-flags(aarch64-pageoff, aarch64-nc) @g :: (store 4 into @g)
38    BLR renamable $x19, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
39
40    STRWui killed renamable $w21, killed renamable $x20, target-flags(aarch64-pageoff, aarch64-nc) @g :: (store 4 into @g)
41    BLR killed renamable $x19, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
42
43    TCRETURNdi @foo, 0, csr_aarch64_aapcs, implicit $sp
44...
45