This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PRs 30904 and 31058


This fixes aforementioned PRs by teaching VRP on how to deal with
RSHIFT_EXPRs in propagatin value ranges.  Which is actually easy as
we can handle it the same way as the *_DIV_EXPR case.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to mainline.

Richard.


2007-03-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/30904
	PR middle-end/31058
	* tree-vrp.c (extract_range_from_binary_expr): Handle RSHIFT_EXPR
	the same way as *_DIV_EXPR.

	* gcc.dg/pr30904.c: Remove xfail.

Index: tree-vrp.c
===================================================================
*** tree-vrp.c	(revision 122691)
--- tree-vrp.c	(working copy)
*************** extract_range_from_binary_expr (value_ra
*** 1568,1573 ****
--- 1568,1574 ----
        && code != CEIL_DIV_EXPR
        && code != EXACT_DIV_EXPR
        && code != ROUND_DIV_EXPR
+       && code != RSHIFT_EXPR
        && code != MIN_EXPR
        && code != MAX_EXPR
        && code != BIT_AND_EXPR
*************** extract_range_from_binary_expr (value_ra
*** 1735,1741 ****
  	   || code == FLOOR_DIV_EXPR
  	   || code == CEIL_DIV_EXPR
  	   || code == EXACT_DIV_EXPR
! 	   || code == ROUND_DIV_EXPR)
      {
        tree val[4];
        size_t i;
--- 1736,1743 ----
  	   || code == FLOOR_DIV_EXPR
  	   || code == CEIL_DIV_EXPR
  	   || code == EXACT_DIV_EXPR
! 	   || code == ROUND_DIV_EXPR
! 	   || code == RSHIFT_EXPR)
      {
        tree val[4];
        size_t i;
Index: testsuite/gcc.dg/pr30904.c
===================================================================
*** testsuite/gcc.dg/pr30904.c	(revision 122746)
--- testsuite/gcc.dg/pr30904.c	(working copy)
*************** int main (void)
*** 14,18 ****
  }
  
  
! /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "optimized" } } */
--- 14,18 ----
  }
  
  
! /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"  } } */
  /* { dg-final { cleanup-tree-dump "optimized" } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]