diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 10 | 
1 files changed, 9 insertions, 1 deletions
| diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index dfd258d592e..d8793782228 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -177,6 +177,10 @@ char &llvm::TwoAddressInstructionPassID = TwoAddressInstructionPass::ID;  bool TwoAddressInstructionPass::Sink3AddrInstruction(MachineBasicBlock *MBB,                                             MachineInstr *MI, unsigned SavedReg,                                             MachineBasicBlock::iterator OldPos) { +  // FIXME: Shouldn't we be trying to do this before we three-addressify the +  // instruction?  After this transformation is done, we no longer need +  // the instruction to be in three-address form. +    // Check if it's safe to move this instruction.    bool SeenStore = true; // Be conservative.    if (!MI->isSafeToMove(TII, AA, SeenStore)) @@ -217,7 +221,11 @@ bool TwoAddressInstructionPass::Sink3AddrInstruction(MachineBasicBlock *MBB,      break;    } -  if (!KillMI || KillMI->getParent() != MBB || KillMI == MI) +  // If we find the instruction that kills SavedReg, and it is in an +  // appropriate location, we can try to sink the current instruction +  // past it. +  if (!KillMI || KillMI->getParent() != MBB || KillMI == MI || +      KillMI->getDesc().isTerminator())      return false;    // If any of the definitions are used by another instruction between the | 

