diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2005-05-27 16:31:29 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2005-05-27 16:31:29 +0000 |
commit | 46aad78f22f0d84855daed56e7369e73e31c8c26 (patch) | |
tree | f43746efbc3b2066008ddcc71e7b5829eb7349b0 | |
parent | 8b60fb432a133613e348278fa9037d70c3243cd3 (diff) | |
download | gcc-46aad78f22f0d84855daed56e7369e73e31c8c26.zip gcc-46aad78f22f0d84855daed56e7369e73e31c8c26.tar.gz gcc-46aad78f22f0d84855daed56e7369e73e31c8c26.tar.bz2 |
re PR tree-optimization/21658 (CCP does not propagate ADDR_EXPR far enough.)
gcc/
PR tree-optimization/21658
* tree-ssa-ccp.c (ccp_fold): Call fold_binary instead of
fold_binary_to_constant. Likewise, call fold_unary instead of
fold_unary_to_constant.
testsuite/
PR tree-optimization/21658
* gcc.dg/tree-ssa/pr21658.c: New.
From-SVN: r100266
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr21658.c | 21 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 4 |
4 files changed, 35 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77d2700..557ed56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-05-27 Kazu Hirata <kazu@cs.umass.edu> + + PR tree-optimization/21658 + * tree-ssa-ccp.c (ccp_fold): Call fold_binary instead of + fold_binary_to_constant. Likewise, call fold_unary instead of + fold_unary_to_constant. + 2005-05-27 Nathan Sidwell <nathan@codesourcery.com> * vec.h: Implement integral type vector specialization. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a6bdc7..efeae61 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-05-27 Kazu Hirata <kazu@cs.umass.edu> + + PR tree-optimization/21658 + * gcc.dg/tree-ssa/pr21658.c: New. + 2005-05-27 Nathan Sidwell <nathan@codesourcery.com> PR c++/21455 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c new file mode 100644 index 0000000..993b493 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/21658 + CCP did not propagate an ADDR_EXPR far enough, preventing the "if" + statement below from being folded. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-ccp-details" } */ + +void link_error (void); + +void +f (void) +{ + int a[10]; + int *p = &a[5]; + int *q = p - 1; + if (q != &a[4]) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "with if \\(0\\)" 1 "ccp"} } */ +/* { dg-final { cleanup-tree-dump "ccp" } } */ diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 45472f4..c1593f8 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -849,7 +849,7 @@ ccp_fold (tree stmt) op0 = get_value (op0, true)->value; } - retval = fold_unary_to_constant (code, TREE_TYPE (rhs), op0); + retval = fold_unary (code, TREE_TYPE (rhs), op0); /* If we folded, but did not create an invariant, then we can not use this expression. */ @@ -900,7 +900,7 @@ ccp_fold (tree stmt) op1 = val->value; } - retval = fold_binary_to_constant (code, TREE_TYPE (rhs), op0, op1); + retval = fold_binary (code, TREE_TYPE (rhs), op0, op1); /* If we folded, but did not create an invariant, then we can not use this expression. */ |