summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.cpp6
-rw-r--r--llvm/test/CodeGen/AArch64/machine-outliner.mir5
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index ef0a785abfc..8be6b24a92e 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -4841,6 +4841,12 @@ AArch64InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT,
return MachineOutlinerInstrType::Illegal;
}
+ // Special cases for instructions that can always be outlined, but will fail
+ // the later tests. e.g, ADRPs, which are PC-relative use LR, but can always
+ // be outlined because they don't require a *specific* value to be in LR.
+ if (MI.getOpcode() == AArch64::ADRP)
+ return MachineOutlinerInstrType::Legal;
+
// Outline calls without stack parameters or aggregate parameters.
if (MI.isCall()) {
const Module *M = MF->getFunction().getParent();
diff --git a/llvm/test/CodeGen/AArch64/machine-outliner.mir b/llvm/test/CodeGen/AArch64/machine-outliner.mir
index f8e60926d75..58c06411bc6 100644
--- a/llvm/test/CodeGen/AArch64/machine-outliner.mir
+++ b/llvm/test/CodeGen/AArch64/machine-outliner.mir
@@ -1,6 +1,8 @@
# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner %s -o - | FileCheck %s
--- |
+ @x = common global i32 0, align 4
+
define void @baz() #0 {
ret void
}
@@ -58,6 +60,7 @@ body: |
%w16 = ORRWri %wzr, 1
%w16 = ORRWri %wzr, 1
%w16 = ORRWri %wzr, 1
+ renamable %x9 = ADRP target-flags(aarch64-page) @x
%x16 = ADDXri %sp, 48, 0;
STRHHroW %w16, %x9, %w30, 1, 1
%lr = ORRXri %xzr, 1
@@ -70,6 +73,7 @@ body: |
%w16 = ORRWri %wzr, 1
%w16 = ORRWri %wzr, 1
%w16 = ORRWri %wzr, 1
+ renamable %x9 = ADRP target-flags(aarch64-page) @x
%x16 = ADDXri %sp, 48, 0;
STRHHroW %w16, %x9, %w30, 1, 1
%lr = ORRXri %xzr, 1
@@ -83,6 +87,7 @@ body: |
%w16 = ORRWri %wzr, 1
%w16 = ORRWri %wzr, 1
%w16 = ORRWri %wzr, 1
+ renamable %x9 = ADRP target-flags(aarch64-page) @x
%x16 = ADDXri %sp, 48, 0;
STRHHroW %w16, %x9, %w30, 1, 1
%lr = ORRXri %xzr, 1
OpenPOWER on IntegriCloud