This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Handling non-constant bounds in extract_range_from_cond


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.

jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]