diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-20 07:09:20 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-20 07:09:20 +0000 |
commit | 88d02c9e3e2d8e03745271bac7541767d9f553b5 (patch) | |
tree | ee911e5a5331d4a03e36339c0a1164fe6ef47658 /gcc/tree-chrec.c | |
parent | 14bd4516ee52a24e4f7d8873494c7842587ae6e5 (diff) | |
download | gcc-88d02c9e3e2d8e03745271bac7541767d9f553b5.tar.gz |
PR tree-optimization/18463
* tree-chrec.c (chrec_convert): Return fold_converted chrec if
converting it directly is not possible.
(chrec_convert_aggressive): New function.
* tree-chrec.h (chrec_convert_aggressive): Declare.
* tree-scalar-evolution.c (instantiate_parameters_1, resolve_mixers):
Fold chrec conversions aggressively if asked to.
(instantiate_parameters): Modified because of changes in
instantiate_parameters_1.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104443 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r-- | gcc/tree-chrec.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 88b27d84aa6..0bf1d384592 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -1164,9 +1164,7 @@ chrec_convert (tree type, tree chrec, tree at_stmt) fprintf (dump_file, "\n)\n"); } - /* Directly convert to "don't know": no worth dealing with - difficult cases. */ - return chrec_dont_know; + return fold_convert (type, chrec); } return build_polynomial_chrec (CHREC_VARIABLE (chrec), @@ -1201,6 +1199,35 @@ chrec_convert (tree type, tree chrec, tree at_stmt) return res; } +/* Convert CHREC to TYPE, without regard to signed overflows. Returns the new + chrec if something else than what chrec_convert would do happens, NULL_TREE + otherwise. */ + +tree +chrec_convert_aggressive (tree type, tree chrec) +{ + tree inner_type, left, right, lc, rc; + + if (automatically_generated_chrec_p (chrec) + || TREE_CODE (chrec) != POLYNOMIAL_CHREC) + return NULL_TREE; + + inner_type = TREE_TYPE (chrec); + if (TYPE_PRECISION (type) > TYPE_PRECISION (inner_type)) + return NULL_TREE; + + left = CHREC_LEFT (chrec); + right = CHREC_RIGHT (chrec); + lc = chrec_convert_aggressive (type, left); + if (!lc) + lc = chrec_convert (type, left, NULL_TREE); + rc = chrec_convert_aggressive (type, right); + if (!rc) + rc = chrec_convert (type, right, NULL_TREE); + + return build_polynomial_chrec (CHREC_VARIABLE (chrec), lc, rc); +} + /* Returns the type of the chrec. */ tree |