summaryrefslogtreecommitdiff
path: root/gcc/tree-affine.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-30 09:28:14 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-30 09:28:14 +0000
commit2ccb5abdfd402f4a33071c4a6a20c92b1ec0f399 (patch)
tree2bc849178633a1d10806791d26cd3af88a6bcfa0 /gcc/tree-affine.c
parente07df203878f420604e848797728632eb999eda4 (diff)
downloadgcc-2ccb5abdfd402f4a33071c4a6a20c92b1ec0f399.tar.gz
2007-07-30 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/32527 * tree-affine.h (aff_tree): The type of rest is sizetype for types of pointers. * tree-affine.c (aff_combination_scale): If type is a pointer type, use sizetype for rest. (aff_combination_add_elt): Likewise. Don't specialize pointer types. (aff_combination_convert): Don't convert rest for pointer types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127058 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-affine.c')
-rw-r--r--gcc/tree-affine.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c
index 972d4423f70..75281884f7f 100644
--- a/gcc/tree-affine.c
+++ b/gcc/tree-affine.c
@@ -110,6 +110,9 @@ aff_combination_scale (aff_tree *comb, double_int scale)
if (comb->rest)
{
+ tree type = comb->type;
+ if (POINTER_TYPE_P (type))
+ type = sizetype;
if (comb->n < MAX_AFF_ELTS)
{
comb->elts[comb->n].coef = scale;
@@ -118,8 +121,8 @@ aff_combination_scale (aff_tree *comb, double_int scale)
comb->n++;
}
else
- comb->rest = fold_build2 (MULT_EXPR, comb->type, comb->rest,
- double_int_to_tree (comb->type, scale));
+ comb->rest = fold_build2 (MULT_EXPR, type, comb->rest,
+ double_int_to_tree (type, scale));
}
}
@@ -181,14 +184,8 @@ aff_combination_add_elt (aff_tree *comb, tree elt, double_int scale)
double_int_to_tree (type, scale));
if (comb->rest)
- {
- if (POINTER_TYPE_P (comb->type))
- comb->rest = fold_build2 (POINTER_PLUS_EXPR, comb->type,
- comb->rest, elt);
- else
- comb->rest = fold_build2 (PLUS_EXPR, comb->type, comb->rest,
- elt);
- }
+ comb->rest = fold_build2 (PLUS_EXPR, type, comb->rest,
+ elt);
else
comb->rest = elt;
}
@@ -231,7 +228,7 @@ aff_combination_convert (aff_tree *comb, tree type)
}
comb->type = type;
- if (comb->rest)
+ if (comb->rest && !POINTER_TYPE_P (type))
comb->rest = fold_convert (type, comb->rest);
if (TYPE_PRECISION (type) == TYPE_PRECISION (comb_type))