diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-30 18:28:19 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-30 18:28:19 +0000 |
commit | 135b982ddc5c8174c57dc9e8f294c7bf476bc9d2 (patch) | |
tree | d57bbbc4b9b65da04a915f26455cd3254ace9c7e /gcc/tree-ssa-forwprop.c | |
parent | f8ca591b66df0cd27537a4e2c0c8118097493030 (diff) | |
download | gcc-135b982ddc5c8174c57dc9e8f294c7bf476bc9d2.tar.gz |
2014-01-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/59993
* tree-ssa-forwprop.c (associate_pointerplus): Check we
can propagate form the earlier stmt and avoid the transform
when the intermediate result is needed.
* gcc.dg/torture/pr59993.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207316 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index ebdd8f546f2..b2294290077 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2926,11 +2926,13 @@ associate_pointerplus (gimple_stmt_iterator *gsi) /* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */ ptr = gimple_assign_rhs1 (stmt); off1 = gimple_assign_rhs2 (stmt); - if (TREE_CODE (ptr) != SSA_NAME) + if (TREE_CODE (ptr) != SSA_NAME + || !has_single_use (ptr)) return false; def_stmt = SSA_NAME_DEF_STMT (ptr); if (!is_gimple_assign (def_stmt) - || gimple_assign_rhs_code (def_stmt) != POINTER_PLUS_EXPR) + || gimple_assign_rhs_code (def_stmt) != POINTER_PLUS_EXPR + || !can_propagate_from (def_stmt)) return false; ptr = gimple_assign_rhs1 (def_stmt); off2 = gimple_assign_rhs2 (def_stmt); |