Boostrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2011-03-22  Richard Guenther  <rguent...@suse.de>

        PR tree-optimization/48228
        * tree-vrp.c (vrp_visit_phi_node): Do not stop propagating
        for single-arg PHIs.

        * gcc.dg/Wstrict-overflow-23.c: New testcase.

Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c      (revision 171285)
--- gcc/tree-vrp.c      (working copy)
*************** vrp_visit_phi_node (gimple phi)
*** 6619,6624 ****
--- 6619,6625 ----
       edge; this helps us avoid an overflow infinity for conditionals
       which are not in a loop.  */
    if (edges > 0
+       && gimple_phi_num_args (phi) > 1
        && edges == old_edges)
      {
        int cmp_min = compare_values (lhs_vr->min, vr_result.min);
Index: gcc/testsuite/gcc.dg/Wstrict-overflow-23.c
===================================================================
*** gcc/testsuite/gcc.dg/Wstrict-overflow-23.c  (revision 0)
--- gcc/testsuite/gcc.dg/Wstrict-overflow-23.c  (revision 0)
***************
*** 0 ****
--- 1,31 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -Wstrict-overflow" } */
+ 
+ unsigned int
+ do_scrolling (unsigned int window_size, unsigned int writecost)
+ {
+   unsigned int i = window_size;
+ 
+   int terminal_window_p = 0;
+   unsigned int queue = 0;
+ 
+   for (i = window_size; i; i--)
+     {
+       if (writecost < i)
+     ++queue;
+       else if (writecost & 1)
+     terminal_window_p = 1;
+     }
+ 
+   if (queue > 0)
+     {
+       if (!terminal_window_p)
+     {
+       terminal_window_p = 1;
+     }
+     }
+ 
+   if (terminal_window_p)
+     return 100;
+   return 0;
+ }

Reply via email to