[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner clattner at apple.com
Sat Mar 24 22:24:22 PDT 2007


> @@ -2443,10 +2443,9 @@
>    // Check to see if this is an unsigned division with an exact  
> power of 2,
>    // if so, convert to a right shift.
>    if (ConstantInt *C = dyn_cast<ConstantInt>(Op1)) {
> -    APInt Val(C->getValue());
> -    if (Val != 0 && Val.isPowerOf2())    // Don't break X / 0
> +    if (!C->isZero() && C->getValue().isPowerOf2())  // Don't  
> break X / 0

Zero isn't a power of two, you should be able to drop the isZero check.

Thanks.  BTW, nice work on instcombine!

-Chris




More information about the llvm-commits mailing list