This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ivopts improvement
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Tom de Vries <vries at codesourcery dot com>
- Cc: rakdver at kam dot mff dot cuni dot cz, gcc-patches at gcc dot gnu dot org, Bernd Schmidt <bernds at codesourcery dot com>, Maxim Kuvyrkov <maxim at codesourcery dot com>
- Date: Mon, 28 Feb 2011 11:37:49 +0100
- Subject: Re: ivopts improvement
- References: <4D6B6DB9.7050302@codesourcery.com>
On 02/28/2011 10:41 AM, Tom de Vries wrote:
The difficulty is that this replacement is only valid under the
guarantee that base + n does not overflow.
I think this should be done unconditionally under
-funsafe-loop-optimizations. Look in the code for examples of how to
add warnings, it should be something like:
bool last_iter_may_overflow;
if (TYPE_OVERFLOW_WRAPS (...))
last_iter_may_overflow = false;
else
{
last_iter_may_overflow = !flag_unsafe_loop_optimizations;
if (warn_unsafe_loop_optimizations)
{
if (flag_unsafe_loop_optimizations)
warning ("assuming ... does not overflow");
else
warning ("not optimizing ... because ... could overflow");
}
}
if (last_iter_may_overflow
&& stmt_after_increment (loop, cand, use->stmt))
Looks like good work, thanks!
Paolo