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

Chris Lattner clattner at apple.com
Fri Mar 23 23:34:25 PDT 2007


On Mar 12, 2007, at 11:41 PM, Zhou Sheng wrote:
> For expression like
> "APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth)",
> to handle ShiftAmt == BitWidth situation, use zextOrCopy() instead of
> zext().

In CVS head instcombine, this zextOrCopy method is only used in one  
place.  Instead of doing this idiom, please add a new  
APInt::getLowBitsSet(i, j), where i is the size of the value and j is  
the number of low bits set in it.

Instcombine currently also does (apint(i, 1)<<j) - 1  to compute  
this.  These uses should call APInt::getLowBitsSet as well.

-Chris



More information about the llvm-commits mailing list