Allow removeLiveIn to be called with a register that isn't live-in.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 28 Mar 2012 20:11:42 +0000 (20:11 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 28 Mar 2012 20:11:42 +0000 (20:11 +0000)
This avoids the silly double search:

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153592 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineBasicBlock.cpp

index ca8a8e8072ad4422ca3e740f59c0c72016679192..6c8a1072697c910601604adb5ca9fd8753305159 100644 (file)
@@ -321,8 +321,8 @@ void MachineBasicBlock::print(raw_ostream &OS, SlotIndexes *Indexes) const {
 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 {