gcse aliasing patch

Richard Henderson rth@cygnus.com
Fri Oct 15 23:59:00 GMT 1999


The attached test case highlights a potential aliasing problem in gcse. 
The "potential" is quite a bit more real in Cygnus' tree -- in the public
tree gcse isn't hooked into the alias code.  A fact that somehow escaped
me for some two hours while trying to design a failing testcase...  :-P

Anyway, the solution is to treat memory expressions differing in alias
set as different expressions.  This is valid because a correct program
cannot (dynamically) refer to the same memory by two different types
(a statement with pedantic qualifications handled elsewhere in the
compiler, well before gcse has a look at the code, and so ignored here).

If there are two dynamic references to the same memory with different
types, the source is in error.  If there are two static references to
the same memory with different types, but only one evaluation happens
at runtime, then the source is correct.  By treating the two evaluations
as different expressions, we ensure by definition that neither is
anticipatible along any shared path, so neither expression is hoisted
where it ought not.


r~


More information about the Gcc-patches mailing list