[Top][All Lists]

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

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

From: Geert Bosch
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Tue, 2 Jan 2007 14:59:24 -0500

On Jan 1, 2007, at 21:14, Ian Lance Taylor wrote:
extern void bar (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.

We should be able to optimize this even for -fwrapv.
For i = 0, the loop will not execute at all, for other
i, execution will stop when i == m, after m - 1 executions
of the loop body. The condition i > 0 will never be true,
regardless of -fwrapv as there won't be overflow.


reply via email to

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