This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Pessimization
- To: John Carr <jfc at mit dot edu>, Gabriel Dos Reis <Gabriel dot Dos-Reis at dptmaths dot ens-cachan dot fr>
- Subject: Re: Pessimization
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Sun, 17 May 1998 13:51:23 -0700
- cc: egcs at cygnus dot com, jbuck at synopsys dot com, law at cygnus dot com
The type based alias code was unsafe, partly because gcc has been
defined to permit aliasing of different types. It is disabled for
now.
The fact that gcc allows type aliasing in unions is not the problem.
The problem is that the code doesn't actually do type-based aliasing. That
is a serious misnomer. The code actually does mode-based aliasing. The
code makes the assumption that one can infer the type from the mode,
and that simply isn't true. It is trivial to create counter examples.
For instance
int i = 10;
int j = (unsigned short) i;
can generate RTL that contains a HImode reference to a SImode object.
Similar things can happen within inline expanded mempcy calls.
Any agressive type-based alias code that uses only information available from
the RTL will never work. If you want type-based aliasing, you need to look at
the actual types in the trees, generate aliasing info from that, and then
propagate it into the RTL.
The current snapshot compiles codes which run 40-50% slowler than they
used to with the previous snapshot (John Carr's patch did great job)
specialy when const references are used.
The current code is actually missing some aliasing that we used to do before
John Carr's April 21 patch. We currently have no mode-based aliasing at all
because the new code is disabled.
I just put the old mode-based aliasing code back, so things might be a little
better now.
Jim