autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


From: Ian Lance Taylor
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: 01 Jan 2007 18:14:19 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

address@hidden (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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]