This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization of offset computations
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: Re: Optimization of offset computations
- From: Bernd Schmidt <bernds at pathia dot cygnus dot co dot uk>
- Date: Tue, 30 Nov 1999 12:04:51 +0000 (GMT)
- cc: rth at cygnus dot com, gcc-patches at gcc dot gnu dot org
> > > unsigned int a = 65536;
> > > b = (a * 65536) / 8;
> > > b = (a * 8192);
>
> To 32 bits, the first is 0x1_0000_0000 = 0 / 8 = 0,
> whereas the second is 0x2000_0000.
> I'm not sure what to do here. sizetype is normally unsigned, so
> restricting this optimization to signed isn't useful. And these are
> quite important optimizations for size computations.
>
> Does anybody have any ideas?
Not sure whether this is feasible, but could we somehow annotate trees that
are made as a result of internal type size calculations so that fold-const
knows it is safe to perform these kinds of optimizations since no overflow
can (should?) happen? Expressions written in the source file like the one
above wouldn't be folded.
Bernd