Use use_empty() instead of getNumUses(), avoiding a use list traversal.
authorDan Gohman <gohman@apple.com>
Mon, 23 Jun 2008 23:23:49 +0000 (23:23 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 23 Jun 2008 23:23:49 +0000 (23:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52651 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopDeletion.cpp

index 3c0e8662a25583bf4dc5553b5657b30b40ff210e..f68a5f7125a064520692c20181f3bac4d269e2af 100644 (file)
@@ -209,7 +209,7 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
     for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
          BI != BE; ) {
       Instruction* I = BI++;
-      if (I->getNumUses() > 0 && IsLoopInvariantInst(I, L))
+      if (!I->use_empty() && IsLoopInvariantInst(I, L))
         I->moveBefore(preheader->getTerminator());
     }