[Bug tree-optimization/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c

2011-06-16 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49419

--- Comment #9 from Jakub Jelinek  2011-06-16 
18:18:55 UTC ---
Created attachment 24548
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24548
gcc47-vrp.patch

So, I've tried this patch for extract_range_from_assert.
It bootstrapped/regtested on x86_64-linux and i686-linux, but regressed
FAIL: g++.dg/tree-ssa/pr18178.C scan-tree-dump-times vrp1 "if " 1
(just the vrp1 dump checking and code removal, the assembly is the same at the
end).
The VR is just different (- is vanilla, + is with the patch).
 Value ranges after VRP:

-i_1: [0, +INF(OVF)]
+i_1: [0, +INF]
 a_3(D): VARYING
 D.2084_4: VARYING
 D.2090_7: VARYING
@@ -681,10 +927,10 @@ D.2094_11: VARYING
 i_12: [1, +INF(OVF)]
 D.2077_13: VARYING
 .MEM_14: VARYING
-i_19: [-INF, D.2084_4 + -1]  EQUIVALENCES: { i_1 } (1 elements)
-i_20: [0, +INF]  EQUIVALENCES: { i_1 i_19 } (2 elements)
+i_19: [0, +INF]  EQUIVALENCES: { } (0 elements)
+i_20: [0, +INF]  EQUIVALENCES: { i_19 } (1 elements)
 a_21: ~[0B, 0B]  EQUIVALENCES: { a_3(D) } (1 elements)
-D.2084_22: [i_19 + 1, +INF]  EQUIVALENCES: { D.2084_4 } (1 elements)
+D.2084_22: [1, +INF]  EQUIVALENCES: { D.2084_4 } (1 elements)
 D.2077_23: ~[0B, 0B]  EQUIVALENCES: { D.2077_13 } (1 elements)

but resulted in:
 Folding statement: if (i_20 >= D.2084_22)
-Folding predicate i_20 >= D.2084_22 to 0
-Folded into: if (0 != 0)
-
+Not folded

So, not sure if I should push this anyway (with adjusting/removing the
testcase), or not.


[Bug tree-optimization/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c

2011-06-16 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49419

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #8 from Jakub Jelinek  2011-06-16 
08:17:46 UTC ---
The bug should be fixed now, though VRP should be cerrtainly improved in
various ways, including choosing better vr during extract_range_from_assert,
trying to derive numeric ranges from symbolic ranges x - 1 maximums or x + 1
minimums,
and IMHO adjust_range_for_scev could use number_of_latch_executions to see if
the number is simple enough and a smaller iteration count can be derived from
its value ranges or, e.g. if it is the init SSA_NAME itself or that plus/minus
a constant, it could determine it doesn't decrease until -INF but only until 0
+- constant.


[Bug tree-optimization/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c

2011-06-16 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49419

--- Comment #7 from Jakub Jelinek  2011-06-16 
07:54:46 UTC ---
Author: jakub
Date: Thu Jun 16 07:54:43 2011
New Revision: 175095

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175095
Log:
PR tree-optimization/49419
* tree-vrp.c (execute_vrp): Call init_range_assertions
before estimate_numbers_of_iterations, call
free_number_of_iterations_estimates before calling
remove_range_assertions.

* gcc.c-torture/execute/pr49419.c: New test.

Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/execute/pr49419.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
branches/gcc-4_6-branch/gcc/tree-vrp.c


[Bug tree-optimization/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c

2011-06-16 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49419

--- Comment #6 from Jakub Jelinek  2011-06-16 
07:45:22 UTC ---
Author: jakub
Date: Thu Jun 16 07:45:17 2011
New Revision: 175092

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175092
Log:
PR tree-optimization/49419
* tree-vrp.c (execute_vrp): Call init_range_assertions
before estimate_numbers_of_iterations, call
free_number_of_iterations_estimates before calling
remove_range_assertions.

* gcc.c-torture/execute/pr49419.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr49419.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c


[Bug tree-optimization/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c

2011-06-15 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49419

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2011.06.15 16:02:59
  Component|target  |tree-optimization
 Ever Confirmed|0   |1