[AggressiveInstCombine] Use use_empty() instead of !getNumUses(), NFC
authorVedant Kumar <vsk@apple.com>
Fri, 2 Mar 2018 23:22:49 +0000 (23:22 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 2 Mar 2018 23:22:49 +0000 (23:22 +0000)
use_empty() runs in O(1), whereas getNumUses() runs in O(# uses).

llvm-svn: 326635

llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp

index d62b643..c72df2d 100644 (file)
@@ -380,7 +380,7 @@ void TruncInstCombine::ReduceExpressionDag(Type *SclTy) {
     // We still need to check that the instruction has no users before we erase
     // it, because {SExt, ZExt}Inst Instruction might have other users that was
     // not reduced, in such case, we need to keep that instruction.
-    if (!I->first->getNumUses())
+    if (I->first->use_empty())
       I->first->eraseFromParent();
   }
 }