[IR] Prefer use_empty() to !hasNUsesOrMore(1) for clarity.
authorDavide Italiano <davide@freebsd.org>
Tue, 16 May 2017 22:38:40 +0000 (22:38 +0000)
committerDavide Italiano <davide@freebsd.org>
Tue, 16 May 2017 22:38:40 +0000 (22:38 +0000)
llvm-svn: 303218

llvm/lib/Transforms/Scalar/LICM.cpp
llvm/lib/Transforms/Scalar/Reassociate.cpp

index 340c81f..37b9c4b 100644 (file)
@@ -546,7 +546,7 @@ static bool isLoadInvariantInLoop(LoadInst *LI, DominatorTree *DT,
     // If there are escaping uses of invariant.start instruction, the load maybe
     // non-invariant.
     if (!II || II->getIntrinsicID() != Intrinsic::invariant_start ||
-        II->hasNUsesOrMore(1))
+        !II->use_empty())
       continue;
     unsigned InvariantSizeInBits =
         cast<ConstantInt>(II->getArgOperand(0))->getSExtValue() * 8;
index ef29d41..53320bf 100644 (file)
@@ -1922,7 +1922,7 @@ Instruction *ReassociatePass::canonicalizeNegConstExpr(Instruction *I) {
 
   // User must be a binary operator with one or more uses.
   Instruction *User = I->user_back();
-  if (!isa<BinaryOperator>(User) || !User->hasNUsesOrMore(1))
+  if (!isa<BinaryOperator>(User) || User->use_empty())
     return nullptr;
 
   unsigned UserOpcode = User->getOpcode();