[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp

Devang Patel dpatel at apple.com
Tue Aug 29 15:29:32 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

LoopUnswitch.cpp updated: 1.46 -> 1.47
---
Log message:

Do not rely on std::sort and std::erase to get list of unique
exit blocks. The output is dependent on addresses of basic block.

Add and use Loop::getUniqueExitBlocks.


---
Diffs of the changes:  (+4 -10)

 LoopUnswitch.cpp |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.46 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.47
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.46	Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp	Tue Aug 29 17:29:16 2006
@@ -570,11 +570,8 @@
   LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
 
   std::vector<BasicBlock*> ExitBlocks;
-  L->getExitBlocks(ExitBlocks);
-  std::sort(ExitBlocks.begin(), ExitBlocks.end());
-  ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()),
-                   ExitBlocks.end());
-  
+  L->getUniqueExitBlocks(ExitBlocks);
+
   // Split all of the edges from inside the loop to their exit blocks.  Update
   // the appropriate Phi nodes as we do so.
   unsigned NumBlocks = L->getBlocks().size();
@@ -626,11 +623,8 @@
   
   // The exit blocks may have been changed due to edge splitting, recompute.
   ExitBlocks.clear();
-  L->getExitBlocks(ExitBlocks);
-  std::sort(ExitBlocks.begin(), ExitBlocks.end());
-  ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()),
-                   ExitBlocks.end());
-  
+  L->getUniqueExitBlocks(ExitBlocks);
+
   // Add exit blocks to the loop blocks.
   LoopBlocks.insert(LoopBlocks.end(), ExitBlocks.begin(), ExitBlocks.end());
 






More information about the llvm-commits mailing list