aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenth@gcc.gnu.org>2005-06-02 21:55:52 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2005-06-02 21:55:52 +0000
commit1c1205fb0b9a3270c1bc43e6ad21cd23669081b2 (patch)
tree5da965d0b7d30f4ab47448b7dee5619e882dc4f5
parent8ab5f5c9fa2e5161b4822e2205a17f6b5ba6528a (diff)
downloadgcc-1c1205fb0b9a3270c1bc43e6ad21cd23669081b2.zip
gcc-1c1205fb0b9a3270c1bc43e6ad21cd23669081b2.tar.gz
gcc-1c1205fb0b9a3270c1bc43e6ad21cd23669081b2.tar.bz2
tree-chrec.c (chrec_fold_plus_1): Ensure we build binary operations with the correct types.
2005-06-02 Richard Guenther <rguenth@gcc.gnu.org> * tree-chrec.c (chrec_fold_plus_1): Ensure we build binary operations with the correct types. * tree-ssa-loo-ivopts.c (idx_find_step): Use sizetype for all computation. From-SVN: r100517
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-chrec.c4
-rw-r--r--gcc/tree-ssa-loop-ivopts.c16
3 files changed, 17 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a67fa10..2f1cc16 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2005-06-02 Richard Guenther <rguenth@gcc.gnu.org>
+
+ * tree-chrec.c (chrec_fold_plus_1): Ensure we build
+ binary operations with the correct types.
+ * tree-ssa-loo-ivopts.c (idx_find_step): Use sizetype
+ for all computation.
+
2005-06-02 Kazu Hirata <kazu@codesourcery.com>
* tree-vrp.c, config/arm/arm.md, config/arm/arm1020e.md,
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 335bc7c..bd8bafc 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -293,7 +293,9 @@ chrec_fold_plus_1 (enum tree_code code,
&& size < PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
return build2 (code, type, op0, op1);
else if (size < PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
- return fold_build2 (code, type, op0, op1);
+ return fold_build2 (code, type,
+ fold_convert (type, op0),
+ fold_convert (type, op1));
else
return chrec_dont_know;
}
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 7962d62..8e4a574 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1389,7 +1389,7 @@ idx_find_step (tree base, tree *idx, void *data)
{
struct ifs_ivopts_data *dta = data;
struct iv *iv;
- tree step, type, iv_type, iv_step, lbound, off;
+ tree step, iv_step, lbound, off;
struct loop *loop = dta->ivopts_data->current_loop;
if (TREE_CODE (base) == MISALIGNED_INDIRECT_REF
@@ -1430,8 +1430,6 @@ idx_find_step (tree base, tree *idx, void *data)
if (!iv->step)
return true;
- iv_type = TREE_TYPE (iv->base);
- type = build_pointer_type (TREE_TYPE (base));
if (TREE_CODE (base) == ARRAY_REF)
{
step = array_ref_element_size (base);
@@ -1442,13 +1440,13 @@ idx_find_step (tree base, tree *idx, void *data)
}
else
/* The step for pointer arithmetics already is 1 byte. */
- step = build_int_cst (type, 1);
+ step = build_int_cst (sizetype, 1);
- if (TYPE_PRECISION (iv_type) < TYPE_PRECISION (type))
+ if (TYPE_PRECISION (TREE_TYPE (iv->base)) < TYPE_PRECISION (sizetype))
iv_step = can_count_iv_in_wider_type (dta->ivopts_data->current_loop,
- type, iv->base, iv->step, dta->stmt);
+ sizetype, iv->base, iv->step, dta->stmt);
else
- iv_step = fold_convert (iv_type, iv->step);
+ iv_step = fold_convert (sizetype, iv->step);
if (!iv_step)
{
@@ -1456,12 +1454,12 @@ idx_find_step (tree base, tree *idx, void *data)
return false;
}
- step = fold_build2 (MULT_EXPR, type, step, iv_step);
+ step = fold_build2 (MULT_EXPR, sizetype, step, iv_step);
if (!*dta->step_p)
*dta->step_p = step;
else
- *dta->step_p = fold_build2 (PLUS_EXPR, type, *dta->step_p, step);
+ *dta->step_p = fold_build2 (PLUS_EXPR, sizetype, *dta->step_p, step);
return true;
}