From patchwork Fri Aug 20 23:44:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 62334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AB1A9B70DD for ; Sat, 21 Aug 2010 09:45:25 +1000 (EST) Received: (qmail 1333 invoked by alias); 20 Aug 2010 23:45:19 -0000 Received: (qmail 1215 invoked by uid 22791); 20 Aug 2010 23:45:17 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 Aug 2010 23:45:09 +0000 Received: by gya6 with SMTP id 6so1690990gya.20 for ; Fri, 20 Aug 2010 16:45:07 -0700 (PDT) Received: by 10.151.73.13 with SMTP id a13mr2427827ybl.434.1282347907820; Fri, 20 Aug 2010 16:45:07 -0700 (PDT) Received: from napoca ([163.181.251.115]) by mx.google.com with ESMTPS id q36sm841426yba.12.2010.08.20.16.45.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 20 Aug 2010 16:45:07 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Fri, 20 Aug 2010 18:45:04 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, Sebastian Pop Subject: [PATCH 3/6] Fix chrec_contains_symbols_defined_in_loop. Date: Fri, 20 Aug 2010 18:44:37 -0500 Message-Id: <1282347880-797-4-git-send-email-sebpop@gmail.com> In-Reply-To: <1282347880-797-1-git-send-email-sebpop@gmail.com> References: <1282347880-797-1-git-send-email-sebpop@gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 2010-08-20 Sebastian Pop * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and FIELD_DECL. Return false for an SSA_NAME_IS_DEFAULT_DEF. (compute_scalar_evolution_in_loop): Do not further analyze the scalar evolution when no_evolution_in_loop_p returns true. --- gcc/ChangeLog.graphite | 9 +++++++++ gcc/tree-scalar-evolution.c | 25 ++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 16b5dfa..c8d810c 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,14 @@ 2010-08-20 Sebastian Pop + * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): + Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, + RESULT_DECL, and FIELD_DECL. Return false for an + SSA_NAME_IS_DEFAULT_DEF. + (compute_scalar_evolution_in_loop): Do not further analyze the + scalar evolution when no_evolution_in_loop_p returns true. + +2010-08-20 Sebastian Pop + * tree-chrec.h (evolution_function_is_affine_p): Do not check whether CHREC_LEFT is invariant. A function is affine when CHREC_RIGHT is invariant. diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 5b6ce7b..24e19e0 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -385,19 +385,17 @@ chrec_contains_symbols_defined_in_loop (const_tree chrec, unsigned loop_nb) if (is_gimple_min_invariant (chrec)) return false; - if (TREE_CODE (chrec) == VAR_DECL - || TREE_CODE (chrec) == PARM_DECL - || TREE_CODE (chrec) == FUNCTION_DECL - || TREE_CODE (chrec) == LABEL_DECL - || TREE_CODE (chrec) == RESULT_DECL - || TREE_CODE (chrec) == FIELD_DECL) - return true; - if (TREE_CODE (chrec) == SSA_NAME) { - gimple def = SSA_NAME_DEF_STMT (chrec); - struct loop *def_loop = loop_containing_stmt (def); - struct loop *loop = get_loop (loop_nb); + gimple def; + loop_p def_loop, loop; + + if (SSA_NAME_IS_DEFAULT_DEF (chrec)) + return false; + + def = SSA_NAME_DEF_STMT (chrec); + def_loop = loop_containing_stmt (def); + loop = get_loop (loop_nb); if (def_loop == NULL) return false; @@ -1816,13 +1814,18 @@ compute_scalar_evolution_in_loop (struct loop *wrto_loop, struct loop *def_loop, tree ev) { + bool val; tree res; + if (def_loop == wrto_loop) return ev; def_loop = superloop_at_depth (def_loop, loop_depth (wrto_loop) + 1); res = compute_overall_effect_of_inner_loop (def_loop, ev); + if (no_evolution_in_loop_p (res, wrto_loop->num, &val) && val) + return res; + return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet); }