OSDN Git Service

make inSubLoop much more efficient.
authorChris Lattner <sabre@nondot.org>
Sun, 2 Jan 2011 18:53:08 +0000 (18:53 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 2 Jan 2011 18:53:08 +0000 (18:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122703 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index 4a80376..ba75c6f 100644 (file)
@@ -131,10 +131,7 @@ namespace {
     ///
     bool inSubLoop(BasicBlock *BB) {
       assert(CurLoop->contains(BB) && "Only valid if BB is IN the loop");
-      for (Loop::iterator I = CurLoop->begin(), E = CurLoop->end(); I != E; ++I)
-        if ((*I)->contains(BB))
-          return true;  // A subloop actually contains this block!
-      return false;
+      return LI->getLoopFor(BB) != CurLoop;
     }
 
     /// sink - When an instruction is found to only be used outside of the loop,