VRP no longer (since 4.1.2 at least) can optimize vrp06.c in one go
because we happen to chose a symbolic range when

Intersecting
  [j_12(D), j_12(D)]  EQUIVALENCES: { i_9(D) j_12(D) i_24 i_26 } (4 
elements)
and
  [10, 30]  EQUIVALENCES: { i_9(D) i_26 } (2 elements)
to
  [j_12(D), j_12(D)]  EQUIVALENCES: { i_9(D) j_12(D) i_24 i_26 } (4 
elements)

that pessimizes further refinement of ranges which happens
without looking at equivalences.  We also seem to not consider
equivalences when folding predicates during propagation (anyone
can create a regression testcase out of that now?  we really
should do that), thus it's important to choose [10, 30] above
to be able to fold the following < 0 test.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Richard.

2013-01-11  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/55936
        * tree-vrp.c (intersect_ranges): As fallback choose the
        range we can easiest refine further.

        * gcc.dg/tree-ssa/vrp06.c: Adjust.

Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c      (revision 195103)
--- gcc/tree-vrp.c      (working copy)
*************** intersect_ranges (enum value_range_type
*** 7782,7791 ****
        else
        gcc_unreachable ();
      }
! 
!   /* As a fallback simply use { *VRTYPE, *VR0MIN, *VR0MAX } as
!      result for the intersection.  That's always a conservative
!      correct estimate.  */
  
    return;
  }
--- 7782,7804 ----
        else
        gcc_unreachable ();
      }
!   else
!     {
!       /* As a fallback simply use the range that is closest to
!        an integer constant range.  That's always a conservative
!        correct estimate.  */
!       if (((TREE_CODE (*vr0min) == INTEGER_CST)
!          + (TREE_CODE (*vr0max) == INTEGER_CST)
!          + (*vr0type == VR_RANGE))
!         < ((TREE_CODE (vr1min) == INTEGER_CST)
!            + (TREE_CODE (vr1max) == INTEGER_CST)
!            + (vr1type == VR_RANGE)))
!       {
!         *vr0type = vr1type;
!         *vr0min = vr1min;
!         *vr0max = vr1max;
!       }
!     }
  
    return;
  }
Index: gcc/testsuite/gcc.dg/tree-ssa/vrp06.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/vrp06.c       (revision 195103)
--- gcc/testsuite/gcc.dg/tree-ssa/vrp06.c       (working copy)
*************** foo (int i, int j, int a)
*** 27,31 ****
  
  /* { dg-final { scan-tree-dump-times "Folding predicate i_\[0-9\]+.*0 to 0" 1 
"vrp1" } } */
  /* { dg-final { scan-tree-dump-times "Folding predicate j_\[0-9\]+.*0 to 1" 1 
"vrp1" } } */
! /* { dg-final { scan-tree-dump-times "Folding predicate 
i_\[0-9]+.*j_\[0-9\]+.* to 0" 1 "vrp1" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "vrp1" } } */
--- 27,31 ----
  
  /* { dg-final { scan-tree-dump-times "Folding predicate i_\[0-9\]+.*0 to 0" 1 
"vrp1" } } */
  /* { dg-final { scan-tree-dump-times "Folding predicate j_\[0-9\]+.*0 to 1" 1 
"vrp1" } } */
! /* { dg-final { scan-tree-dump-times "Folding predicate 
i_\[0-9]+.*j_\[0-9\]+.* to 0" 1 "vrp1" } } */
  /* { dg-final { cleanup-tree-dump "vrp1" } } */

Reply via email to