This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- From: Ian Lance Taylor <iant at google dot com>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: autoconf-patches at gnu dot org, bug-gnulib at gnu dot org, gcc at gcc dot gnu dot org
- Date: 01 Jan 2007 18:14:19 -0800
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- References: <87fybbyq27.fsf@penguin.cs.ucla.edu> <20061220123349.GE7947@iam.uni-bonn.de> <emc3jc$eap$1@sea.gmane.org> <87mz57xjlf.fsf@penguin.cs.ucla.edu> <m3odpmsnlc.fsf@localhost.localdomain> <45996521.3090405@codesourcery.com> <87tzza49iz.fsf@penguin.cs.ucla.edu> <4aca3dc20701011700k62de98b2udff5890dad4f0c79@mail.gmail.com> <10701020151.AA22534@vlsi1.ultra.nyu.edu>
kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:
> The question that I'd like to understand the answer to is what kinds of
> optimizations DO we get by having VRP optimized signed overflow. Is it just
> the elimination of tests on overflow? If so, then it strikes me as
> definitely wrong since those tests are probably there precisely to test for
> overflow.
VRP as currently written adjust limits out to "infinity" of an
appropriate sign for variables which are changed in loops. It then
assumes that the (signed) variable will not wrap past that point,
since that would constitute undefined signed overflow.
For example:
extern void bar (void);
void
foo (int m)
{
int i;
for (i = 1; i < m; ++i)
{
if (i > 0)
bar ();
}
}
Here the limit for i without -fwrapv becomes (1, INF]. This enables
VRP to eliminate the test "i > 0". With -fwrapv, this test of course
can not be eliminated. VRP is the only optimization pass which is
able to eliminate that test.
Ian