> Implement isOneBitSet in terms of APInt::countPopulation.

> @@ -3474,8 +3474,7 @@
>  // 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;
>  }

Are you sure this is a good idea?  countPopulation is *much* slower  
than a couple of and's and a subtract.

-Chris
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to