From 5f6a89562d5faeec3cf5e141373917284c34102d Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Tue, 20 Mar 2007 00:16:52 +0000 Subject: [PATCH] Make isOneBitSet faster by using APInt::isPowerOf2. Thanks Chris. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35194 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index c87a351e63b..287a0077ec6 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -3472,7 +3472,7 @@ static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) { // isOneBitSet - Return true if there is exactly one bit set in the specified // constant. static bool isOneBitSet(const ConstantInt *CI) { - return CI->getValue().countPopulation() == 1; + return CI->getValue().isPowerOf2(); } #if 0 // Currently unused