[llvm-commits] [llvm] r107960 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h

Gabor Greif ggreif at gmail.com
Fri Jul 9 03:32:31 PDT 2010


Author: ggreif
Date: Fri Jul  9 05:32:31 2010
New Revision: 107960

URL: http://llvm.org/viewvc/llvm-project?rev=107960&view=rev
Log:
another case of reuse result of operator*, it is expensive to recompute

Modified:
    llvm/trunk/include/llvm/Analysis/LoopInfo.h

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=107960&r1=107959&r2=107960&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Fri Jul  9 05:32:31 2010
@@ -285,12 +285,14 @@
     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?");





More information about the llvm-commits mailing list