From 44e33e674ad560b6e6d063a930e7af6d846fb0eb Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 19 Mar 2007 21:04:43 +0000 Subject: [PATCH] Implement isOneBitSet in terms of APInt::countPopulation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35186 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index e38622a569f..dbe694fad78 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -3474,8 +3474,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) { - uint64_t V = CI->getZExtValue(); - return V && (V & (V-1)) == 0; + return CI->getValue().countPopulation() == 1; } #if 0 // Currently unused