This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: possible gcse failure: not able to eliminate redundant loads
- From: Alex Rosenberg <alexr at spies dot com>
- To: Richard Henderson <rth at redhat dot com>, Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: egcs <gcc at gcc dot gnu dot org>
- Date: Mon, 16 Dec 2002 16:16:01 -0800
- Subject: Re: possible gcse failure: not able to eliminate redundant loads
on 12/16/02 1:12 PM, Richard Henderson at rth@redhat.com wrote:
> On Mon, Dec 16, 2002 at 10:04:01PM +0100, Toon Moene wrote:
>> BTW, I wasn't aware it's legal to dereference NULL C pointers.
>
> It isn't, of course. But that's the whole point. You've
> got code that says
>
> x = (condition ? *p : 0);
>
> i.e. the dereference is protected by a conditional. Thus
> we can't hoist the dereference past the conditional (and
> thence out of the loop that started this thread).
This may be obvious, but... this transformation is legal on some platforms.
AIX maps page 0 as read-only and zero-filled. IBM's xlC compiler will hoist
loads past a conditional with this knowledge. (It doesn't map the high end
of the address space similarly -- one of IBM's countless Java
implementations takes advantage of this discrepancy.)
IA64, Transmeta and other architectures split the job of a load into two
parts to enable exactly this sort of optimization.
+------------------------------------------------------------+
| Alexander M. Rosenberg <mailto:alexr@_spies.com> |
| Nobody cares what I say. Remove the underscore to mail me. |