Simplify code
authorChris Lattner <sabre@nondot.org>
Wed, 10 Dec 2003 16:58:24 +0000 (16:58 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 10 Dec 2003 16:58:24 +0000 (16:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10371 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index cab43bd9fe1fa3c1f133e83397a461de14a5df78..ab64ece96b2543c5ba8f01eb49ce0ff7a003a776 100644 (file)
@@ -437,10 +437,8 @@ void LICM::sink(Instruction &I) {
       BasicBlock *ExitBlock = ExitBlocks[i];
 
       if (isExitBlockDominatedByBlockInLoop(ExitBlock, InstOrigBB)) {
-        std::set<BasicBlock*>::iterator SI =
-          InsertedBlocks.lower_bound(ExitBlock);
         // If we haven't already processed this exit block, do so now.
-        if (SI == InsertedBlocks.end() || *SI != ExitBlock) {
+        if (InsertedBlocks.insert(ExitBlock).second) {
           // Insert the code after the last PHI node...
           BasicBlock::iterator InsertPt = ExitBlock->begin();
           while (isa<PHINode>(InsertPt)) ++InsertPt;
@@ -461,9 +459,6 @@ void LICM::sink(Instruction &I) {
           
           // Now that we have inserted the instruction, store it into the alloca
           new StoreInst(New, AI, InsertPt);
-          
-          // Remember we processed this block
-          InsertedBlocks.insert(SI, ExitBlock);
         }
       }
     }