summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-08-01 19:40:16 +0000
committerJuergen Ributzka <juergen@apple.com>2014-08-01 19:40:16 +0000
commit5dcb33bdbbccd5e713c043417efae6d089abea5b (patch)
tree37e6106ff3b3dba8e94574afac4c5bc8196da16e /llvm/lib
parentf164bee0e07d7f12023e1b6e496cecae53c085a3 (diff)
downloadbcm5719-llvm-5dcb33bdbbccd5e713c043417efae6d089abea5b.tar.gz
bcm5719-llvm-5dcb33bdbbccd5e713c043417efae6d089abea5b.zip
[FastISel][AArch64] Fold offset into the memory operation.
Fold simple offsets into the memory operation: add x0, x0, #8 ldr x0, [x0] --> ldr x0, [x0, #8] Fixes <rdar://problem/17887945>. llvm-svn: 214545
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64FastISel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64FastISel.cpp b/llvm/lib/Target/AArch64/AArch64FastISel.cpp
index f748185bc95..8cfdab24651 100644
--- a/llvm/lib/Target/AArch64/AArch64FastISel.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FastISel.cpp
@@ -419,6 +419,13 @@ bool AArch64FastISel::ComputeAddress(const Value *Obj, Address &Addr) {
}
break;
}
+ case Instruction::Add:
+ // Adds of constants are common and easy enough.
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(U->getOperand(1))) {
+ Addr.setOffset(Addr.getOffset() + (uint64_t)CI->getSExtValue());
+ return ComputeAddress(U->getOperand(0), Addr);
+ }
+ break;
}
// Try to get this in a register if nothing else has worked.
OpenPOWER on IntegriCloud