From patchwork Mon Aug 2 20:20:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 60635 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 3CBD8B6EFE for ; Tue, 3 Aug 2010 06:27:07 +1000 (EST) Received: (qmail 31848 invoked by alias); 2 Aug 2010 20:23:52 -0000 Received: (qmail 31617 invoked by uid 22791); 2 Aug 2010 20:23:47 -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, TW_SV, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gw0-f47.google.com (HELO mail-gw0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 20:23:41 +0000 Received: by gwb15 with SMTP id 15so1552891gwb.20 for ; Mon, 02 Aug 2010 13:23:36 -0700 (PDT) Received: by 10.100.120.14 with SMTP id s14mr3267199anc.151.1280780610975; Mon, 02 Aug 2010 13:23:30 -0700 (PDT) Received: from napoca (cpe-70-120-196-107.austin.res.rr.com [70.120.196.107]) by mx.google.com with ESMTPS id i30sm10331623anh.9.2010.08.02.13.23.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:23:30 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:23:25 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 36/65] chrec_apply should only apply to the specified variable. Date: Mon, 2 Aug 2010 15:20:09 -0500 Message-Id: <1280780438-17543-37-git-send-email-sebpop@gmail.com> In-Reply-To: <1280780438-17543-1-git-send-email-sebpop@gmail.com> References: <1280780438-17543-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 From: spop 2010-07-15 Sebastian Pop * tree-chrec.c (chrec_apply): Should only apply to the specified variable. Also handle multivariate chains of recurrences that satisfy evolution_function_is_affine_p. Also handle CASE_CONVERT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@162244 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/ChangeLog.graphite | 6 ++++++ gcc/tree-chrec.c | 45 +++++++++++++++++++++++++++++++-------------- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec0f773..46b7c59 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2010-08-02 Sebastian Pop + * tree-chrec.c (chrec_apply): Should only apply to the specified + variable. Also handle multivariate chains of recurrences that + satisfy evolution_function_is_affine_p. Also handle CASE_CONVERT. + +2010-08-02 Sebastian Pop + * graphite-clast-to-gimple.c (debug_clast_name_index): Removed. (debug_clast_name_indexes_1): Removed. (debug_clast_name_indexes): Removed. diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 3c7615b..c46bd70 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,11 @@ 2010-07-15 Sebastian Pop + * tree-chrec.c (chrec_apply): Should only apply to the specified + variable. Also handle multivariate chains of recurrences that + satisfy evolution_function_is_affine_p. Also handle CASE_CONVERT. + +2010-07-15 Sebastian Pop + * graphite-clast-to-gimple.c (debug_clast_name_index): Removed. (debug_clast_name_indexes_1): Removed. (debug_clast_name_indexes): Removed. diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index c92b6b9..92f8de9 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -599,23 +599,40 @@ chrec_apply (unsigned var, if (TREE_CODE (x) == INTEGER_CST && SCALAR_FLOAT_TYPE_P (type)) x = build_real_from_int_cst (type, x); - if (evolution_function_is_affine_p (chrec)) + switch (TREE_CODE (chrec)) { - /* "{a, +, b} (x)" -> "a + b*x". */ - x = chrec_convert_rhs (type, x, NULL); - res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x); - res = chrec_fold_plus (type, CHREC_LEFT (chrec), res); - } + case POLYNOMIAL_CHREC: + if (evolution_function_is_affine_p (chrec)) + { + if (CHREC_VARIABLE (chrec) != var) + return build_polynomial_chrec + (CHREC_VARIABLE (chrec), + chrec_apply (var, CHREC_LEFT (chrec), x), + chrec_apply (var, CHREC_RIGHT (chrec), x)); + + /* "{a, +, b} (x)" -> "a + b*x". */ + x = chrec_convert_rhs (type, x, NULL); + res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x); + res = chrec_fold_plus (type, CHREC_LEFT (chrec), res); + } + else if (TREE_CODE (x) == INTEGER_CST + && tree_int_cst_sgn (x) == 1) + /* testsuite/.../ssa-chrec-38.c. */ + res = chrec_evaluate (var, chrec, x, 0); + else + res = chrec_dont_know; + break; - else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC) - res = chrec; + CASE_CONVERT: + res = chrec_convert (TREE_TYPE (chrec), + chrec_apply (var, TREE_OPERAND (chrec, 0), x), + NULL); + break; - else if (TREE_CODE (x) == INTEGER_CST - && tree_int_cst_sgn (x) == 1) - /* testsuite/.../ssa-chrec-38.c. */ - res = chrec_evaluate (var, chrec, x, 0); - else - res = chrec_dont_know; + default: + res = chrec; + break; + } if (dump_file && (dump_flags & TDF_DETAILS)) {