diff options
author | Jessica Paquette <jpaquette@apple.com> | 2018-01-10 18:49:57 +0000 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2018-01-10 18:49:57 +0000 |
commit | c191f1097c52b7b89120dd33d5d3a687e195d633 (patch) | |
tree | 08539ffd8e72fe17d0ef98af5f3965f0295fb267 /llvm | |
parent | d04026ea432578a390e11585a4cc94db4bad8af5 (diff) | |
download | bcm5719-llvm-c191f1097c52b7b89120dd33d5d3a687e195d633.tar.gz bcm5719-llvm-c191f1097c52b7b89120dd33d5d3a687e195d633.zip |
[MachineOutliner] Outline ADRPs
ADRP instructions weren't being outlined because they're PC-relative and thus
fail the LR checks. This patch adds a special case for ADRPs to
getOutliningType to make sure that ADRPs can be outlined and updates the MIR
test.
llvm-svn: 322207
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 6 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/machine-outliner.mir | 5 |
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 |