another case of reuse result of operator*, it is expensive to recompute
authorGabor Greif <ggreif@gmail.com>
Fri, 9 Jul 2010 10:32:31 +0000 (10:32 +0000)
committerGabor Greif <ggreif@gmail.com>
Fri, 9 Jul 2010 10:32:31 +0000 (10:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107960 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopInfo.h

index 9be01dd96f85d1bc2f1182cad29a62b653abd0d3..4a5d5924785a914547309d2356efb106cd1edd2e 100644 (file)
@@ -285,12 +285,14 @@ public:
     typedef GraphTraits<Inverse<BlockT*> > InvBlockTraits;
     for (typename InvBlockTraits::ChildIteratorType PI =
          InvBlockTraits::child_begin(Header),
-         PE = InvBlockTraits::child_end(Header); PI != PE; ++PI)
-      if (!contains(*PI)) {     // If the block is not in the loop...
-        if (Out && Out != *PI)
+         PE = InvBlockTraits::child_end(Header); PI != PE; ++PI) {
+      typename InvBlockTraits::NodeType *N = *PI;
+      if (!contains(N)) {     // If the block is not in the loop...
+        if (Out && Out != N)
           return 0;             // Multiple predecessors outside the loop
-        Out = *PI;
+        Out = N;
       }
+    }
 
     // Make sure there is only one exit out of the preheader.
     assert(Out && "Header of loop has no predecessors from outside loop?");