From d942397e24f76850420d0f70e66bdbb79e49d300 Mon Sep 17 00:00:00 2001 From: Zvi Rackover Date: Tue, 18 Apr 2017 14:55:43 +0000 Subject: [PATCH] LoopRerollPass: Prefer Value::hasOneUse() over Value::getNumUses(). NFC. getNumUses() can be more expensive as it iterates over all list's elements. llvm-svn: 300558 --- llvm/lib/Transforms/Scalar/LoopRerollPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp index 86058fe..d54ad58 100644 --- a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp @@ -557,7 +557,7 @@ bool LoopReroll::isLoopControlIV(Loop *L, Instruction *IV) { Instruction *UUser = dyn_cast(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(UUser)) UUser = dyn_cast(*(UUser->user_begin())); if (!isCompareUsedByBranch(UUser)) -- 2.7.4