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

Chris Lattner clattner at apple.com
Sun Mar 25 12:40:47 PDT 2007


>> Right.  ConstantInt's are immutable, so it doesn't really need to be
>> marked const.  I'm saying that the implementation of these methods
>> shouldn't build a "1" apint, then add it.  Instead, it should just
>> increment an apint with ++.
>
> Yup. I've already changed it to:
>
> static ConstantInt *AddOne(ConstantInt *C) {
>   APInt Val(C->getValue());
>   return ConstantInt::get(++Val);
> }

Beautiful,

-Chris



More information about the llvm-commits mailing list