summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-09-07 22:30:53 +0000
committerJim Grosbach <grosbach@apple.com>2010-09-07 22:30:53 +0000
commit88628e97381ccc696e7fbf17c0380590970609c2 (patch)
tree6c5eb405a2c37bc81714a83aaa678c1c75f434f4
parent41994fd45d2621283d8aa133d4b068c61e800c17 (diff)
downloadbcm5719-llvm-88628e97381ccc696e7fbf17c0380590970609c2.tar.gz
bcm5719-llvm-88628e97381ccc696e7fbf17c0380590970609c2.zip
To shrink a t2LDM instruction to the 16-bit wide tLDM instruction, the base
register must be one of the destination registers for the load. Otherwise, the tLDM instruction will write-back to the base register, which isn't what's desired (otherwise, we'd have a t2LDM_UPD instead). rdar://8394087 llvm-svn: 113297
-rw-r--r--llvm/lib/Target/ARM/Thumb2SizeReduction.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp b/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp
index 1451c53112f..0c3962dd123 100644
--- a/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp
+++ b/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp
@@ -315,6 +315,18 @@ Thumb2SizeReduce::ReduceLoadStore(MachineBasicBlock &MBB, MachineInstr *MI,
ARM_AM::AMSubMode Mode = ARM_AM::getAM4SubMode(MI->getOperand(1).getImm());
if (!isARMLowRegister(BaseReg) || Mode != ARM_AM::ia)
return false;
+ // For the non-writeback version (this one), the base register must be
+ // one of the registers being loaded.
+ bool isOK = false;
+ for (unsigned i = 4; i < MI->getNumOperands(); ++i) {
+ if (MI->getOperand(i).getReg() == BaseReg) {
+ isOK = true;
+ break;
+ }
+ }
+ if (!isOK)
+ return false;
+
OpNum = 0;
isLdStMul = true;
break;
OpenPOWER on IntegriCloud