summaryrefslogtreecommitdiff
path: root/gcc/tree-chrec.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r--gcc/tree-chrec.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 9ceb6f0cf4d..fbd61c08ea6 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -262,8 +262,6 @@ static tree
chrec_fold_plus_1 (enum tree_code code, tree type,
tree op0, tree op1)
{
- tree op1_type = code == POINTER_PLUS_EXPR ? sizetype : type;
-
if (automatically_generated_chrec_p (op0)
|| automatically_generated_chrec_p (op1))
return chrec_fold_automatically_generated_operands (op0, op1);
@@ -327,9 +325,15 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
&& 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,
- fold_convert (type, op0),
- fold_convert (op1_type, op1));
+ {
+ if (code == POINTER_PLUS_EXPR)
+ return fold_build_pointer_plus (fold_convert (type, op0),
+ op1);
+ else
+ return fold_build2 (code, type,
+ fold_convert (type, op0),
+ fold_convert (type, op1));
+ }
else
return chrec_dont_know;
}