diff options
author | Richard Guenther <rguenth@gcc.gnu.org> | 2005-05-11 08:14:44 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2005-05-11 08:14:44 +0000 |
commit | c554294001d28360a26956e7508231fca94f3074 (patch) | |
tree | 1f93266ba272ee270a6ad7b854a342625fa9c228 /gcc/tree-ssa-propagate.c | |
parent | 8a29ce604bdb9588fa66aaabe27c92bf955cab3d (diff) | |
download | gcc-c554294001d28360a26956e7508231fca94f3074.zip gcc-c554294001d28360a26956e7508231fca94f3074.tar.gz gcc-c554294001d28360a26956e7508231fca94f3074.tar.bz2 |
re PR middle-end/19807 (fold does not fold &a[4]-1)
2005-05-11 Richard Guenther <rguenth@gcc.gnu.org>
PR middle-end/19807
PR tree-optimization/19639
* fold-const.c (try_move_mult_to_index): Handle INTEGER_CST
and generic summands for char* as s * delta, too, folding &a[i]
CODE x to &a[i CODE x/s]. Use tree_int_cst_equal
for comparison of steps. Convert types for index addition.
(fold_binary): Adjust the callers to always dispatch to
try_move_mult_to_index.
* tree-ssa-propagate.c (set_rhs): Avoid setting rhs to
expr with non-gimple ARRAY_REF offset.
* g++.dg/tree-ssa/pr19807.C: New testcase.
From-SVN: r99568
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 9f9fef1..c83d2cd 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -576,6 +576,12 @@ set_rhs (tree *stmt_p, tree expr) if (!is_gimple_val (TREE_OPERAND (expr, 0))) return false; } + else if (code == ADDR_EXPR) + { + if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF + && !is_gimple_val (TREE_OPERAND (TREE_OPERAND (expr, 0), 1))) + return false; + } else if (code == COMPOUND_EXPR) return false; |