diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-22 16:26:32 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-22 16:26:32 +0000 |
commit | 78350879556239f5d05ec2e1f7f08a53704ea2cf (patch) | |
tree | 2a5f3f06f213f2d53444674a77ae2fb00b1cd032 /gcc/tree-scalar-evolution.c | |
parent | 47df80848b5f2fa8f614bd43e35b7ee2486b9d85 (diff) | |
download | gcc-78350879556239f5d05ec2e1f7f08a53704ea2cf.tar.gz |
2006-08-22 Richard Guenther <rguenther@suse.de>
PR middle-end/28776
* tree-scalar-evolution.c (fold_used_pointer): Add at_stmt
parameter. Convert arguments to arithmetic expression to the
chrecs type.
(analyze_scalar_evolution_1): Adjust caller.
* gcc.c-torture/compile/pr28776-1.c: New testcase.
* gcc.c-torture/compile/pr28776-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116326 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r-- | gcc/tree-scalar-evolution.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 13cbe42b55f..9bd122adc47 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1765,7 +1765,8 @@ pointer_offset_p (tree expr) /* EXPR is a scalar evolution of a pointer that is dereferenced or used in comparison. This means that it must point to a part of some object in memory, which enables us to argue about overflows and possibly simplify - the EXPR. Returns the simplified value. + the EXPR. AT_STMT is the statement in which this conversion has to be + performed. Returns the simplified value. Currently, for @@ -1820,7 +1821,7 @@ pointer_offset_p (tree expr) bugs. */ static tree -fold_used_pointer (tree expr) +fold_used_pointer (tree expr, tree at_stmt) { tree op0, op1, new0, new1; enum tree_code code = TREE_CODE (expr); @@ -1833,13 +1834,13 @@ fold_used_pointer (tree expr) if (pointer_offset_p (op1)) { - new0 = fold_used_pointer (op0); + new0 = fold_used_pointer (op0, at_stmt); new1 = fold_used_pointer_cast (op1); } else if (code == PLUS_EXPR && pointer_offset_p (op0)) { new0 = fold_used_pointer_cast (op0); - new1 = fold_used_pointer (op1); + new1 = fold_used_pointer (op1, at_stmt); } else return expr; @@ -1847,6 +1848,9 @@ fold_used_pointer (tree expr) if (new0 == op0 && new1 == op1) return expr; + new0 = chrec_convert (TREE_TYPE (expr), new0, at_stmt); + new1 = chrec_convert (TREE_TYPE (expr), new1, at_stmt); + if (code == PLUS_EXPR) expr = chrec_fold_plus (TREE_TYPE (expr), new0, new1); else @@ -1948,7 +1952,7 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res) if (POINTER_TYPE_P (type) && !automatically_generated_chrec_p (res) && pointer_used_p (var)) - res = fold_used_pointer (res); + res = fold_used_pointer (res, def); break; case PHI_NODE: |