[llvm-commits] [llvm] r153592 - /llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Mar 28 13:11:42 PDT 2012


Author: stoklund
Date: Wed Mar 28 15:11:42 2012
New Revision: 153592

URL: http://llvm.org/viewvc/llvm-project?rev=153592&view=rev
Log:
Allow removeLiveIn to be called with a register that isn't live-in.

This avoids the silly double search:

  if (isLiveIn(Reg))
    removeLiveIn(Reg);

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

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=153592&r1=153591&r2=153592&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Wed Mar 28 15:11:42 2012
@@ -321,8 +321,8 @@
 void MachineBasicBlock::removeLiveIn(unsigned Reg) {
   std::vector<unsigned>::iterator I =
     std::find(LiveIns.begin(), LiveIns.end(), Reg);
-  assert(I != LiveIns.end() && "Not a live in!");
-  LiveIns.erase(I);
+  if (I != LiveIns.end())
+    LiveIns.erase(I);
 }
 
 bool MachineBasicBlock::isLiveIn(unsigned Reg) const {





More information about the llvm-commits mailing list