From patchwork Mon Aug 2 20:19:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 60610 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 491B7B6EFE for ; Tue, 3 Aug 2010 06:23:36 +1000 (EST) Received: (qmail 24876 invoked by alias); 2 Aug 2010 20:22:10 -0000 Received: (qmail 24607 invoked by uid 22791); 2 Aug 2010 20:22:07 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, TW_CF, TW_SV, TW_TM, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 20:22:01 +0000 Received: by gxk2 with SMTP id 2so1547060gxk.20 for ; Mon, 02 Aug 2010 13:21:59 -0700 (PDT) Received: by 10.150.11.12 with SMTP id 12mr7570958ybk.101.1280780519155; Mon, 02 Aug 2010 13:21:59 -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 q25sm5731742ybk.18.2010.08.02.13.21.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:21:58 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:21:55 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 12/65] Detect commutative reductions in all the scops before rewriting out of SSA all the other scalar dependences. Date: Mon, 2 Aug 2010 15:19:45 -0500 Message-Id: <1280780438-17543-13-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-06-12 Sebastian Pop * graphite-sese-to-poly.c (build_scop_bbs): Not static anymore. (rewrite_reductions_out_of_ssa): Same. (rewrite_commutative_reductions_out_of_ssa): Same. (build_poly_scop): Do not call these functions. * graphite-sese-to-poly.h (build_poly_scop): Declared. (rewrite_reductions_out_of_ssa): Declared. (rewrite_commutative_reductions_out_of_ssa): Declared. * graphite.c (graphite_transform_loops): Call on every scop rewrite_commutative_reductions_out_of_ssa before calling rewrite_reductions_out_of_ssa and build_scop_bbs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@160651 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/ChangeLog.graphite | 13 +++++++++++++ gcc/graphite-sese-to-poly.c | 16 +++++----------- gcc/graphite-sese-to-poly.h | 3 +++ gcc/graphite.c | 14 ++++++++++++++ 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d68719..f2f9d17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,18 @@ 2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (build_scop_bbs): Not static anymore. + (rewrite_reductions_out_of_ssa): Same. + (rewrite_commutative_reductions_out_of_ssa): Same. + (build_poly_scop): Do not call these functions. + * graphite-sese-to-poly.h (build_poly_scop): Declared. + (rewrite_reductions_out_of_ssa): Declared. + (rewrite_commutative_reductions_out_of_ssa): Declared. + * graphite.c (graphite_transform_loops): Call on every scop + rewrite_commutative_reductions_out_of_ssa before calling + rewrite_reductions_out_of_ssa and build_scop_bbs. + +2010-08-02 Sebastian Pop + * graphite-dependences.c (dot_deps): Make system call to dotty run in background. (dot_deps_stmt): Same. diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 2e04618..c74fce0 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,18 @@ 2010-06-12 Sebastian Pop + * graphite-sese-to-poly.c (build_scop_bbs): Not static anymore. + (rewrite_reductions_out_of_ssa): Same. + (rewrite_commutative_reductions_out_of_ssa): Same. + (build_poly_scop): Do not call these functions. + * graphite-sese-to-poly.h (build_poly_scop): Declared. + (rewrite_reductions_out_of_ssa): Declared. + (rewrite_commutative_reductions_out_of_ssa): Declared. + * graphite.c (graphite_transform_loops): Call on every scop + rewrite_commutative_reductions_out_of_ssa before calling + rewrite_reductions_out_of_ssa and build_scop_bbs. + +2010-06-12 Sebastian Pop + * graphite-dependences.c (dot_deps): Make system call to dotty run in background. (dot_deps_stmt): Same. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 68cb2a4..969ef2b 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -462,7 +462,7 @@ build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb, sbitmap reductio /* Gather the basic blocks belonging to the SCOP. */ -static void +void build_scop_bbs (scop_p scop, sbitmap reductions) { sbitmap visited = sbitmap_alloc (last_basic_block); @@ -2399,7 +2399,7 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) /* Rewrite out of SSA all the reduction phi nodes of SCOP. */ -static void +void rewrite_reductions_out_of_ssa (scop_p scop) { basic_block bb; @@ -2578,7 +2578,7 @@ detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg, } /* Detect commutative and associative scalar reductions starting at - the STMT. Return the phi node of the reduction cycle, or NULL. */ + STMT. Return the phi node of the reduction cycle, or NULL. */ static gimple detect_commutative_reduction_assign (gimple stmt, VEC (gimple, heap) **in, @@ -2666,7 +2666,7 @@ initial_value_for_loop_phi (gimple phi) } /* Detect commutative and associative scalar reductions starting at - the loop closed phi node CLOSE_PHI. Return the phi node of the + the loop closed phi node STMT. Return the phi node of the reduction cycle, or NULL. */ static gimple @@ -2874,7 +2874,7 @@ rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop, /* Rewrites all the commutative reductions from SCOP out of SSA. */ -static void +void rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions) { loop_iterator li; @@ -2973,14 +2973,8 @@ void build_poly_scop (scop_p scop) { sese region = SCOP_REGION (scop); - sbitmap reductions = sbitmap_alloc (last_basic_block * 2); graphite_dim_t max_dim; - sbitmap_zero (reductions); - rewrite_commutative_reductions_out_of_ssa (region, reductions); - rewrite_reductions_out_of_ssa (scop); - build_scop_bbs (scop, reductions); - sbitmap_free (reductions); /* FIXME: This restriction is needed to avoid a problem in CLooG. Once CLooG is fixed, remove this guard. Anyways, it makes no diff --git a/gcc/graphite-sese-to-poly.h b/gcc/graphite-sese-to-poly.h index ccf36dd..2e0cc08 100644 --- a/gcc/graphite-sese-to-poly.h +++ b/gcc/graphite-sese-to-poly.h @@ -30,5 +30,8 @@ struct base_alias_pair void build_poly_scop (scop_p); void check_poly_representation (scop_p); +void rewrite_commutative_reductions_out_of_ssa (sese, sbitmap); +void rewrite_reductions_out_of_ssa (scop_p); +void build_scop_bbs (scop_p, sbitmap); #endif diff --git a/gcc/graphite.c b/gcc/graphite.c index 2933d21..bd47cf7 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -253,6 +253,7 @@ graphite_transform_loops (void) bool need_cfg_cleanup_p = false; VEC (scop_p, heap) *scops = NULL; htab_t bb_pbb_mapping; + sbitmap reductions; if (!graphite_initialize ()) return; @@ -266,6 +267,19 @@ graphite_transform_loops (void) } bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free); + reductions = sbitmap_alloc (last_basic_block * 2); + sbitmap_zero (reductions); + + for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++) + rewrite_commutative_reductions_out_of_ssa (SCOP_REGION (scop), reductions); + + for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++) + { + rewrite_reductions_out_of_ssa (scop); + build_scop_bbs (scop, reductions); + } + + sbitmap_free (reductions); for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++) build_poly_scop (scop);