This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix optimization regression in constant folder
firstname.lastname@example.org (Richard Kenner) writes:
> > TYPE_OVERFLOW_WRAPS seems clearly correct for sizetypes (if not, why
> > not, and give us an example).
> For the reason you just gave: it suppresses some optimizations.
It doesn't, though. Having TYPE_OVERFLOW_WRAPS be true for a type
does not cause gcc to avoid any optimizations.
(Not having TYPE_OVERFLOW_UNDEFINED be true does avoid optimizations;
having TYPE_OVERFLOW_WRAPS be true does not.)
> > I really want to move toward a semantics for sizetypes which does not
> > involve mysterious checks for TYPE_IS_SIZETYPE. If we can't do that,
> > we are going to keep breaking the way you want it to work.
> I see it exactly the opposite way around: sizetype means "handle this
> computations in the most efficient way possible" (like my EXACT_DIV_EXPR).
> So any optimization conditionalized on an attribute of the type can simply
> can "|| TYPE_IS_SIZETYPE". But if we go the approach of defining flags in
> a special way to deal with case and then get rid of TYPE_IS_SIZETYPE, we
> have to go through exactly the same problem as now if some other
> attributes are added to types that suppress only some optimizations.
I think that approach winds up being confusing. We have to think
about types in terms of what operations are permitted on them.