OSDN Git Service

[CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero...
authorCraig Topper <craig.topper@intel.com>
Mon, 12 Mar 2018 18:40:59 +0000 (18:40 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 12 Mar 2018 18:40:59 +0000 (18:40 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327314 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CallSiteSplitting.cpp

index ddebaf6..341abde 100644 (file)
@@ -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");