[EMAIL PROTECTED] (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