summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLocal.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-03-16 02:01:51 +0000
committerBill Wendling <isanbard@gmail.com>2010-03-16 02:01:51 +0000
commitb0d27662ea513eb6ea08c3c5101d27fc50da7fb2 (patch)
tree2015bc8fd46e99df44a9f5628334794e41024525 /lib/CodeGen/RegAllocLocal.cpp
parent827f778338a5cdfebe800acb4df13cd4047517d1 (diff)
downloadllvm-b0d27662ea513eb6ea08c3c5101d27fc50da7fb2.tar.gz
llvm-b0d27662ea513eb6ea08c3c5101d27fc50da7fb2.tar.bz2
llvm-b0d27662ea513eb6ea08c3c5101d27fc50da7fb2.tar.xz
Use getFirstTerminator().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index d61c3ff2cb..194fc14848 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/lib/CodeGen/RegAllocLocal.cpp
@@ -671,9 +671,10 @@ void RALocal::ComputeLocalLiveness(MachineBasicBlock& MBB) {
// 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 @@ void RALocal::ComputeLocalLiveness(MachineBasicBlock& MBB) {
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.