Don't use iterator after being erased.
authorJakub Staszak <kubastaszak@gmail.com>
Mon, 26 Nov 2012 22:14:19 +0000 (22:14 +0000)
committerJakub Staszak <kubastaszak@gmail.com>
Mon, 26 Nov 2012 22:14:19 +0000 (22:14 +0000)
llvm-svn: 168622

llvm/lib/CodeGen/MachineCSE.cpp

index 497e000..dbc41de 100644 (file)
@@ -429,8 +429,8 @@ void MachineCSE::ExitScope(MachineBasicBlock *MBB) {
   DEBUG(dbgs() << "Exiting: " << MBB->getName() << '\n');
   DenseMap<MachineBasicBlock*, ScopeType*>::iterator SI = ScopeMap.find(MBB);
   assert(SI != ScopeMap.end());
-  ScopeMap.erase(SI);
   delete SI->second;
+  ScopeMap.erase(SI);
 }
 
 bool MachineCSE::ProcessBlock(MachineBasicBlock *MBB) {