1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/AArch64/machine-outliner-2fixup-blr-terminator.mir
Puyan Lotfi c4f084e133 [MachineOutliner][AArch64] WA for multiple stack fixup cases in MachineOutliner.
In cases where MachineOutliner candidates either are:

  * noreturn
  * have calls with no available LR or free regs
  * Don't use SP

we can end up hitting stack fixup code for the caller and the callee for
a FrameID of MachineOutlinerDefault. This triggers the assert:

  `assert(OF.FrameConstructionID != MachineOutlinerDefault &&
          "Can only fix up stack references once");`

in AArch64InstrInfo.cpp. This assert exists for now because a lot of the
fixup code is not tested to handle fixing up more than once and needs
some better checks and enhancements to avoid potentially generating
illegal code.

I've filed a Bugzilla report to track this until these cases are handled
by the AArch64 MachineOutliner: https://bugs.llvm.org/show_bug.cgi?id=46767

This diff detects cases that will cause these multiple stack fixups and
prune the Candidates from `RepeatedSequenceLocs`.

    Differential Revision: https://reviews.llvm.org/D83923
2020-08-10 15:43:30 -04:00

76 lines
2.6 KiB
YAML

# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner \
# RUN: -verify-machineinstrs %s -o - | FileCheck %s
# CHECK-NOT: OUTLINED_FUNCTION
--- |
define void @f1() #0 { ret void }
define void @f2() #0 { ret void }
define void @f3() #0 { ret void }
define void @f4() #0 { ret void }
attributes #0 = { minsize noredzone "branch-target-enforcement" }
...
---
name: f1
tracksRegLiveness: true
body: |
bb.0:
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x18, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $fp
$x20, $x19 = LDPXi $sp, 11
$x20, $x19 = LDPXi $sp, 12
$x20, $x19 = LDPXi $sp, 13
$x20, $x19 = LDPXi $sp, 14
$x20, $x19 = LDPXi $sp, 18
$x20, $x19 = LDPXi $sp, 19
$x20, $x19 = LDPXi $sp, 20
$x20, $x19 = LDPXi $sp, 21
BLR $x20, implicit $sp
bb.2:
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x18, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $fp
RET undef $lr
...
---
name: f2
tracksRegLiveness: true
body: |
bb.0:
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x18, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $fp
$x20, $x19 = LDPXi $sp, 11
$x20, $x19 = LDPXi $sp, 12
$x20, $x19 = LDPXi $sp, 13
$x20, $x19 = LDPXi $sp, 14
$x20, $x19 = LDPXi $sp, 18
$x20, $x19 = LDPXi $sp, 19
$x20, $x19 = LDPXi $sp, 20
$x20, $x19 = LDPXi $sp, 21
BLR $x20, implicit $sp
bb.2:
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x18, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $fp
RET undef $lr
...
---
name: f3
tracksRegLiveness: true
body: |
bb.0:
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x18, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $fp
$x20, $x19 = LDPXi $sp, 11
$x20, $x19 = LDPXi $sp, 12
$x20, $x19 = LDPXi $sp, 13
$x20, $x19 = LDPXi $sp, 14
$x20, $x19 = LDPXi $sp, 18
$x20, $x19 = LDPXi $sp, 19
$x20, $x19 = LDPXi $sp, 20
$x20, $x19 = LDPXi $sp, 21
BLR $x20, implicit $sp
bb.2:
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x18, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $fp
RET undef $lr
...
---
name: f4
tracksRegLiveness: true
body: |
bb.0:
RET undef $lr