use getUniqueExitBlocks instead of a manual set.
authorChris Lattner <sabre@nondot.org>
Sun, 29 Aug 2010 05:12:21 +0000 (05:12 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Aug 2010 05:12:21 +0000 (05:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112412 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index 639e958f04060c64fd98b0d6de581e75f506c353..a1868af12fde16b3f51273ae4703c8e70978c71b 100644 (file)
@@ -707,18 +707,10 @@ void LICM::PromoteValuesInLoop() {
 
   // Now that the body of the loop uses the allocas instead of the original
   // memory locations, insert code to copy the alloca value back into the
-  // original memory location on all exits from the loop.  Note that we only
-  // want to insert one copy of the code in each exit block, though the loop may
-  // exit to the same block more than once.
-  //
-  SmallPtrSet<BasicBlock*, 16> ProcessedBlocks;
-
+  // original memory location on all exits from the loop.
   SmallVector<BasicBlock*, 8> ExitBlocks;
-  CurLoop->getExitBlocks(ExitBlocks);
+  CurLoop->getUniqueExitBlocks(ExitBlocks);
   for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
-    if (!ProcessedBlocks.insert(ExitBlocks[i]))
-      continue;
-  
     // Copy all of the allocas into their memory locations.
     BasicBlock::iterator BI = ExitBlocks[i]->getFirstNonPHI();
     Instruction *InsertPos = BI;