[llvm-commits] [llvm] r98604 - /llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Bill Wendling isanbard at gmail.com
Mon Mar 15 19:01:52 PDT 2010


Author: void
Date: Mon Mar 15 21:01:51 2010
New Revision: 98604

URL: http://llvm.org/viewvc/llvm-project?rev=98604&view=rev
Log:
Use getFirstTerminator().

Modified:
    llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=98604&r1=98603&r2=98604&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Mon Mar 15 21:01:51 2010
@@ -671,9 +671,10 @@
   
   // Live-out (of the function) registers contain return values of the function,
   // so we need to make sure they are alive at return time.
-  bool BBEndsInReturn = !MBB.empty() && MBB.back().getDesc().isReturn();
-  if (BBEndsInReturn) {
-    MachineInstr* Ret = &MBB.back();
+  MachineBasicBlock::iterator Ret = MBB.getFirstTerminator();
+  bool BBEndsInReturn = (Ret != MBB.end() && Ret->getDesc().isReturn());
+
+  if (BBEndsInReturn)
     for (MachineRegisterInfo::liveout_iterator
          I = MF->getRegInfo().liveout_begin(),
          E = MF->getRegInfo().liveout_end(); I != E; ++I)
@@ -681,7 +682,6 @@
         Ret->addOperand(MachineOperand::CreateReg(*I, false, true));
         LastUseDef[*I] = std::make_pair(Ret, Ret->getNumOperands()-1);
       }
-  }
   
   // Finally, loop over the final use/def of each reg 
   // in the block and determine if it is dead.





More information about the llvm-commits mailing list