Make sure candidate for delay slot filler is not a return instruction.
authorAkira Hatanaka <ahatanaka@mips.com>
Wed, 5 Oct 2011 18:16:09 +0000 (18:16 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Wed, 5 Oct 2011 18:16:09 +0000 (18:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141196 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsDelaySlotFiller.cpp

index b8443c1030bef54ab0b8e38a74f23e4c104e06d5..94bdd68107852047e71dbf2cd2cd69b3f43c4599 100644 (file)
@@ -174,15 +174,16 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
   if (candidate->isImplicitDef() || candidate->isKill())
     return true;
 
+  MCInstrDesc MCID = candidate->getDesc();
   // Loads or stores cannot be moved past a store to the delay slot
   // and stores cannot be moved past a load. 
-  if (candidate->getDesc().mayLoad()) {
+  if (MCID.mayLoad()) {
     if (sawStore)
       return true;
     sawLoad = true;
   }
 
-  if (candidate->getDesc().mayStore()) {
+  if (MCID.mayStore()) {
     if (sawStore)
       return true;
     sawStore = true;
@@ -190,7 +191,8 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
       return true;
   }
 
-  assert(!candidate->getDesc().isCall() && "Cannot put calls in delay slot.");
+  assert((!MCID.isCall() && !MCID.isReturn()) &&
+         "Cannot put calls in delay slot.");
 
   for (unsigned i = 0, e = candidate->getNumOperands(); i!= e; ++i) {
     const MachineOperand &MO = candidate->getOperand(i);