summaryrefslogtreecommitdiff
path: root/lib/Target/AArch64/AArch64InstructionSelector.cpp
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-27 17:31:56 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-27 17:31:56 +0000
commit97874bddd63328616c18a0e8230f6732c02ba3ba (patch)
treeebf127d9321954cc2567f7108769c17b06f24fbc /lib/Target/AArch64/AArch64InstructionSelector.cpp
parentdb6b71ba7954fad8e37a9c53ec84de95c3ae177e (diff)
[GlobalISel][AArch64] Fold FI into LDR/STR ui addressing mode.
A majority of loads and stores at O0 access an alloca. It's trivial to fold the G_FRAME_INDEX into the instruction; do it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/AArch64/AArch64InstructionSelector.cpp')
-rw-r--r--lib/Target/AArch64/AArch64InstructionSelector.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/AArch64/AArch64InstructionSelector.cpp b/lib/Target/AArch64/AArch64InstructionSelector.cpp
index be0f6eb44d1..70c11c125ef 100644
--- a/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ b/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -792,6 +792,11 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
}
}
+ // If we haven't folded anything into our addressing mode yet, try to fold
+ // a frame index into the base+offset.
+ if (!Offset && PtrMI->getOpcode() == TargetOpcode::G_FRAME_INDEX)
+ I.getOperand(1).ChangeToFrameIndex(PtrMI->getOperand(1).getIndex());
+
I.addOperand(MachineOperand::CreateImm(Offset));
// If we're storing a 0, use WZR/XZR.