[llvm] r300558 - LoopRerollPass: Prefer Value::hasOneUse() over Value::getNumUses(). NFC.
Zvi Rackover via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 18 07:55:43 PDT 2017
Author: zvi
Date: Tue Apr 18 09:55:43 2017
New Revision: 300558
URL: http://llvm.org/viewvc/llvm-project?rev=300558&view=rev
Log:
LoopRerollPass: Prefer Value::hasOneUse() over Value::getNumUses(). NFC.
getNumUses() can be more expensive as it iterates over all list's elements.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopRerollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopRerollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRerollPass.cpp?rev=300558&r1=300557&r2=300558&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopRerollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopRerollPass.cpp Tue Apr 18 09:55:43 2017
@@ -557,7 +557,7 @@ bool LoopReroll::isLoopControlIV(Loop *L
Instruction *UUser = dyn_cast<Instruction>(UU);
// Skip SExt if we are extending an nsw value
// TODO: Allow ZExt too
- if (BO->hasNoSignedWrap() && UUser && UUser->getNumUses() == 1 &&
+ if (BO->hasNoSignedWrap() && UUser && UUser->hasOneUse() &&
isa<SExtInst>(UUser))
UUser = dyn_cast<Instruction>(*(UUser->user_begin()));
if (!isCompareUsedByBranch(UUser))
More information about the llvm-commits
mailing list