summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-04 04:39:26 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-04 04:39:26 +0000
commit2595dcbb4c9bc83e3fa552689d846bbcfe14cd00 (patch)
tree236f463bef02f6702038ffc5f6ea1966a3010bf5 /gcc
parent0115829605efb68727d310de92fd6202e30a1b5f (diff)
downloadgcc-2595dcbb4c9bc83e3fa552689d846bbcfe14cd00.tar.gz
2007-07-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
* tree-ssa-loop-ivopts.c (strip_offset_1): Treat POINTER_PLUS_EXPR like PLUS_EXPR. (rewrite_use_nonlinear_expr): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-ssa-loop-ivopts.c14
2 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd5d7038026..dc785cb7d89 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * tree-ssa-loop-ivopts.c (strip_offset_1): Treat POINTER_PLUS_EXPR
+ like PLUS_EXPR.
+ (rewrite_use_nonlinear_expr): Likewise.
+
2007-07-03 Seongbae Park <seongbae.park@gmail.com>
* rtl.def (UNSPEC, USE, CLOBBER): More comments.
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 7337d0213f3..f99a6ebf990 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1759,6 +1759,7 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref,
*offset = int_cst_value (expr);
return build_int_cst (orig_type, 0);
+ case POINTER_PLUS_EXPR:
case PLUS_EXPR:
case MINUS_EXPR:
op0 = TREE_OPERAND (expr, 0);
@@ -1767,7 +1768,7 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref,
op0 = strip_offset_1 (op0, false, false, &off0);
op1 = strip_offset_1 (op1, false, false, &off1);
- *offset = (code == PLUS_EXPR ? off0 + off1 : off0 - off1);
+ *offset = (code == MINUS_EXPR ? off0 - off1 : off0 + off1);
if (op0 == TREE_OPERAND (expr, 0)
&& op1 == TREE_OPERAND (expr, 1))
return orig_expr;
@@ -1776,10 +1777,10 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref,
expr = op0;
else if (integer_zerop (op0))
{
- if (code == PLUS_EXPR)
- expr = op1;
- else
+ if (code == MINUS_EXPR)
expr = fold_build1 (NEGATE_EXPR, type, op1);
+ else
+ expr = op1;
}
else
expr = fold_build2 (code, type, op0, op1);
@@ -4893,11 +4894,12 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
thus leading to ICE. */
op = GIMPLE_STMT_OPERAND (use->stmt, 1);
if (TREE_CODE (op) == PLUS_EXPR
- || TREE_CODE (op) == MINUS_EXPR)
+ || TREE_CODE (op) == MINUS_EXPR
+ || TREE_CODE (op) == POINTER_PLUS_EXPR)
{
if (TREE_OPERAND (op, 0) == cand->var_before)
op = TREE_OPERAND (op, 1);
- else if (TREE_CODE (op) == PLUS_EXPR
+ else if (TREE_CODE (op) != MINUS_EXPR
&& TREE_OPERAND (op, 1) == cand->var_before)
op = TREE_OPERAND (op, 0);
else