From 3980a7911a5d571ffde04868b977ed343e6b55ba Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 24 Apr 2008 09:06:33 +0000 Subject: - Check if a register is livein before removing it. It may have already been removed. - Do not iterate over SmallPtrSet, the order of iteration is not deterministic. llvm-svn: 50209 --- llvm/lib/CodeGen/MachineBasicBlock.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp') diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index af91a2fb15c..58ca6efcfe2 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -205,6 +205,11 @@ void MachineBasicBlock::removeLiveIn(unsigned Reg) { LiveIns.erase(I); } +bool MachineBasicBlock::isLiveIn(unsigned Reg) const { + const_livein_iterator I = std::find(livein_begin(), livein_end(), Reg); + return I != livein_end(); +} + void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) { MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList(); getParent()->getBasicBlockList().splice(NewAfter, BBList, this); -- cgit v1.2.3