From 98acb419f002937108fe95d95fb87b655bc7efd6 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 14 Apr 2014 08:09:06 +0000 Subject: 2014-04-14 Richard Biener PR tree-optimization/59817 PR tree-optimization/60453 * graphite-scop-detection.c (graphite_can_represent_scev): Complete recursion to catch all CHRECs in the scalar evolution and restrict the predicate for the remains appropriately. * gfortran.dg/graphite/pr59817.f: New testcase. * gcc.dg/graphite/pr59817-1.c: Likewise. * gcc.dg/graphite/pr59817-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209355 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/graphite-scop-detection.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/graphite-scop-detection.c') diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index b5e4a8c8cb3..821f0846ef2 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -219,7 +219,14 @@ graphite_can_represent_scev (tree scev) switch (TREE_CODE (scev)) { + case NEGATE_EXPR: + case BIT_NOT_EXPR: + CASE_CONVERT: + case NON_LVALUE_EXPR: + return graphite_can_represent_scev (TREE_OPERAND (scev, 0)); + case PLUS_EXPR: + case POINTER_PLUS_EXPR: case MINUS_EXPR: return graphite_can_represent_scev (TREE_OPERAND (scev, 0)) && graphite_can_represent_scev (TREE_OPERAND (scev, 1)); @@ -241,13 +248,15 @@ graphite_can_represent_scev (tree scev) if (!evolution_function_right_is_integer_cst (scev) || !graphite_can_represent_init (scev)) return false; + return graphite_can_represent_scev (CHREC_LEFT (scev)); default: break; } /* Only affine functions can be represented. */ - if (!scev_is_linear_expression (scev)) + if (tree_contains_chrecs (scev, NULL) + || !scev_is_linear_expression (scev)) return false; return true; -- cgit v1.2.1