[llvm] r327314 - [CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero return from getNumUses

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 11:40:59 PDT 2018


Author: ctopper
Date: Mon Mar 12 11:40:59 2018
New Revision: 327314

URL: http://llvm.org/viewvc/llvm-project?rev=327314&view=rev
Log:
[CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero return from getNumUses

getNumUses is a linear operation. It walks a linked list to get a count. So in this case its better to just ask if there are any users rather than how many.

Modified:
    llvm/trunk/lib/Transforms/Scalar/CallSiteSplitting.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/CallSiteSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CallSiteSplitting.cpp?rev=327314&r1=327313&r2=327314&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CallSiteSplitting.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CallSiteSplitting.cpp Mon Mar 12 11:40:59 2018
@@ -302,7 +302,7 @@ static void splitCallSite(
   // `musttail` calls must be followed by optional `bitcast`, and `ret`. The
   // split blocks will be terminated right after that so there're no users for
   // this phi in a `TailBB`.
-  if (!IsMustTailCall && Instr->getNumUses())
+  if (!IsMustTailCall && !Instr->use_empty())
     CallPN = PHINode::Create(Instr->getType(), Preds.size(), "phi.call");
 
   DEBUG(dbgs() << "split call-site : " << *Instr << " into \n");




More information about the llvm-commits mailing list