aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-07-27 04:18:04 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-07-27 04:18:04 +0000
commit1f5c9887544ac2cb39d48e35cc6fa7a7b73ed3b0 (patch)
treeae653265d57ea987c9a9b793c744202214a23f59
parent5732ca084aaa0cd26149e50dd4b487efff37fe41 (diff)
If CPSR is modified but the def is dead, then it's ok to fold the load / store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77182 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/ARM/ARMBaseInstrInfo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 2d1a5a8f6e..9f3edc7228 100644
--- a/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -681,7 +681,7 @@ foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI,
MachineInstr *NewMI = NULL;
if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) {
// If it is updating CPSR, then it cannot be folded.
- if (MI->getOperand(4).getReg() != ARM::CPSR) {
+ if (MI->getOperand(4).getReg() != ARM::CPSR || MI->getOperand(4).isDead()) {
unsigned Pred = MI->getOperand(2).getImm();
unsigned PredReg = MI->getOperand(3).getReg();
if (OpNum == 0) { // move -> store
@@ -771,6 +771,7 @@ ARMBaseInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
MachineInstr* MI,
const SmallVectorImpl<unsigned> &Ops,
MachineInstr* LoadMI) const {
+ // FIXME
return 0;
}
@@ -782,7 +783,7 @@ ARMBaseInstrInfo::canFoldMemoryOperand(const MachineInstr *MI,
unsigned Opc = MI->getOpcode();
if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) {
// If it is updating CPSR, then it cannot be folded.
- return MI->getOperand(4).getReg() != ARM::CPSR;
+ return MI->getOperand(4).getReg() != ARM::CPSR ||MI->getOperand(4).isDead();
} else if (Opc == ARM::FCPYS || Opc == ARM::FCPYD) {
return true;
} else if (Opc == ARM::VMOVD || Opc == ARM::VMOVQ) {