From: Evan Cheng Date: Mon, 27 Jul 2009 04:18:04 +0000 (+0000) Subject: If CPSR is modified but the def is dead, then it's ok to fold the load / store. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=371ec9e8102e5f03f46bdb4b361d33e7d8a852f0;p=platform%2Fupstream%2Fllvm.git If CPSR is modified but the def is dead, then it's ok to fold the load / store. llvm-svn: 77182 --- diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index 2d1a5a8..9f3edc7 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/llvm/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 &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) {