diff options
author | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-20 18:28:09 +0000 |
---|---|---|
committer | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-20 18:28:09 +0000 |
commit | 8e6331c6fead11d2e8a114f2d6b9aaf044eb40d7 (patch) | |
tree | 68389f4eeee19e630e626e651160bf036340c454 /gcc/gimple-ssa-strength-reduction.c | |
parent | 2590979b10e67ff56addd9493e574f659897a629 (diff) | |
download | gcc-8e6331c6fead11d2e8a114f2d6b9aaf044eb40d7.tar.gz |
PR tree-optimization/55350
* gimple-ssa-strength-reduction.c (replace_dependent): Handle
POINTER_{PLUS,MINUS}_EXPR correctly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193672 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-ssa-strength-reduction.c')
-rw-r--r-- | gcc/gimple-ssa-strength-reduction.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 8e2a24758dd..65fc6b14859 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -1643,10 +1643,19 @@ replace_dependent (slsr_cand_t c, enum tree_code cand_code) basis = lookup_cand (c->basis); basis_name = gimple_assign_lhs (basis->cand_stmt); - incr_type = TREE_TYPE (gimple_assign_rhs1 (c->cand_stmt)); - code = PLUS_EXPR; + if (cand_code == POINTER_PLUS_EXPR) + { + incr_type = sizetype; + code = cand_code; + } + else + { + incr_type = TREE_TYPE (gimple_assign_rhs1 (c->cand_stmt)); + code = PLUS_EXPR; + } - if (bump.is_negative ()) + if (bump.is_negative () + && cand_code != POINTER_PLUS_EXPR) { code = MINUS_EXPR; bump = -bump; |