On Sun, 2007-03-25 at 12:25 -0700, Chris Lattner wrote:
> >
> >>> +/// SubOne - Subtract one from a ConstantInt
> >>> static ConstantInt *SubOne(ConstantInt *C) {
> >>
> >> Shouldn't these use ++/-- on APInt? That seems more efficient.
> >
> > I should really have these functions declare the parameter
> > constant. We
> > don't want to increment the APInt inside C. Either way, a copy of the
> > value is being made.
>
> 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);
}
Reid.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ llvm-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
