[PATCH] D30182: [LoopSimplify] Simplify how we compute UniqueExit

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 17:25:18 PST 2017


trentxintong created this revision.

Simplify how we compute UniqueExit. Reuse ExitBlockSet.


https://reviews.llvm.org/D30182

Files:
  lib/Transforms/Utils/LoopSimplify.cpp


Index: lib/Transforms/Utils/LoopSimplify.cpp
===================================================================
--- lib/Transforms/Utils/LoopSimplify.cpp
+++ lib/Transforms/Utils/LoopSimplify.cpp
@@ -645,14 +645,7 @@
   // loop-invariant instructions out of the way to open up more
   // opportunities, and the disadvantage of having the responsibility
   // to preserve dominator information.
-  bool UniqueExit = true;
-  if (!ExitBlocks.empty())
-    for (unsigned i = 1, e = ExitBlocks.size(); i != e; ++i)
-      if (ExitBlocks[i] != ExitBlocks[0]) {
-        UniqueExit = false;
-        break;
-      }
-  if (UniqueExit) {
+  if (ExitBlockSet.size() == 1) {
     for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) {
       BasicBlock *ExitingBlock = ExitingBlocks[i];
       if (!ExitingBlock->getSinglePredecessor()) continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30182.89150.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170221/25113704/attachment.bin>


More information about the llvm-commits mailing list