This is the mail archive of the
mailing list for the GCC project.
Re: Handling non-constant bounds in extract_range_from_cond
- From: Jeffrey A Law <law at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: laurent at guerby dot net, gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Nov 2004 16:39:22 -0700
- Subject: Re: Handling non-constant bounds in extract_range_from_cond
- Organization: Red Hat, Inc
- References: <10411292336.AA02574@vlsi1.ultra.nyu.edu>
- Reply-to: law at redhat dot com
On Mon, 2004-11-29 at 18:36 -0500, Richard Kenner wrote:
> But this transformation is a performance loss if the expression can be
> proved true by the compiler or if one of the two bound checks can be
> omitted due to compiler knowledge.
> Well sure, but is this really going to occur in real life?
> In other words, are there really going to be such code written when the
> programmer *didn't* mean X'Valid?
> This isn't C where this sort of stuff pops up all the time due to macros:
> this can only occur if the code is specifically written that way.
> If the programmer *didn't* know about 'Valid, we can be sure that he meant
> to write 'Valid and so the optimization would be unfriendly. But if the
> programmer *did* know about 'Valid and also knew that this would always be
> true, then why would he write it?
> I don't see a single case where the optimization would be appropriate.
As you say, it may not be appropriate for Ada, but it is appropriate
for C and possibly other languages.
It seems to me that the semantics of this stuff really needs to be for
the object to be converted into the base type, then compared to the
range of the subtype -- before we get to the gimplification phase.