summaryrefslogtreecommitdiff
path: root/gcc/graphite-scop-detection.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-23 07:50:00 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-23 07:50:00 +0000
commit99c136a5c82827b52d3b52299b11c3f6db65dff4 (patch)
tree77aae9e220ccba498af701a1b8b9a38e715f711c /gcc/graphite-scop-detection.c
parent8972df285867666549ef0b398eedc52b26ad0d73 (diff)
downloadgcc-99c136a5c82827b52d3b52299b11c3f6db65dff4.tar.gz
Fix PR42181.
2009-12-14 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42181 * graphite-scop-detection.c (graphite_can_represent_scev): Handle more carefully PLUS_EXPR, MINUS_EXPR, and MULT_EXPR. * testsuite/gfortran.dg/graphite/pr42181.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155417 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-scop-detection.c')
-rw-r--r--gcc/graphite-scop-detection.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a24420e9dad..e30554f2799 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -213,15 +213,33 @@ graphite_can_represent_scev (tree scev, int outermost_loop)
if (chrec_contains_undetermined (scev))
return false;
- if (TREE_CODE (scev) == POLYNOMIAL_CHREC
+ switch (TREE_CODE (scev))
+ {
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ return graphite_can_represent_scev (TREE_OPERAND (scev, 0), outermost_loop)
+ && graphite_can_represent_scev (TREE_OPERAND (scev, 1), outermost_loop);
+
+ case MULT_EXPR:
+ return !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 0)))
+ && !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 1)))
+ && !(chrec_contains_symbols (TREE_OPERAND (scev, 0))
+ && chrec_contains_symbols (TREE_OPERAND (scev, 1)))
+ && graphite_can_represent_scev (TREE_OPERAND (scev, 0), outermost_loop)
+ && graphite_can_represent_scev (TREE_OPERAND (scev, 1), outermost_loop);
+ case POLYNOMIAL_CHREC:
/* Check for constant strides. With a non constant stride of
- 'n' we would have a value of 'iv * n'. */
- && (!evolution_function_right_is_integer_cst (scev)
+ 'n' we would have a value of 'iv * n'. Also check that the
+ initial value can represented: for example 'n * m' cannot be
+ represented. */
+ if (!evolution_function_right_is_integer_cst (scev)
+ || !graphite_can_represent_init (scev))
+ return false;
- /* Check the initial value: 'n * m' cannot be represented. */
- || !graphite_can_represent_init (scev)))
- return false;
+ default:
+ break;
+ }
/* Only affine functions can be represented. */
if (!scev_is_linear_expression (scev))