From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30591 invoked by alias); 2 Aug 2010 20:23:34 -0000 Received: (qmail 30317 invoked by uid 22791); 2 Aug 2010 20:23:29 -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,RCVD_IN_DNSWL_NONE,TW_SV,TW_TM,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 20:23:21 +0000 Received: by mail-yx0-f175.google.com with SMTP id 11so1550084yxi.20 for ; Mon, 02 Aug 2010 13:23:21 -0700 (PDT) Received: by 10.150.149.19 with SMTP id w19mr7125694ybd.415.1280780601168; Mon, 02 Aug 2010 13:23:21 -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 v32sm4389519yba.6.2010.08.02.13.23.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:23:20 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:23:17 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 34/65] Remove insert_loop_close_phis. Date: Mon, 02 Aug 2010 20:24:00 -0000 Message-Id: <1280780438-17543-35-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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00116.txt.bz2 From: spop 2010-07-15 Sebastian Pop * graphite-clast-to-gimple.c (translate_clast_for_loop): Do not call insert_loop_close_phis. * sese.c (name_defined_in_loop_p): Removed. (expr_defined_in_loop_p): Removed. (alive_after_loop): Removed. (close_phi_not_yet_inserted_p): Removed. (struct alep): Removed. (add_loop_exit_phis): Removed. (insert_loop_close_phis): Removed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@162242 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 +++ gcc/ChangeLog.graphite | 19 ++++- gcc/graphite-clast-to-gimple.c | 4 - gcc/sese.c | 167 ---------------------------------------- 4 files changed, 27 insertions(+), 175 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c93abbf..301c7a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2010-08-02 Sebastian Pop + + * graphite-clast-to-gimple.c (translate_clast_for_loop): Do not call + insert_loop_close_phis. + * sese.c (name_defined_in_loop_p): Removed. + (expr_defined_in_loop_p): Removed. + (alive_after_loop): Removed. + (close_phi_not_yet_inserted_p): Removed. + (struct alep): Removed. + (add_loop_exit_phis): Removed. + (insert_loop_close_phis): Removed. + 2010-08-02 Andreas Simbuerger * graphite-cloog-util.c diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 806d67e..2cd80ee 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,9 +1,20 @@ +2010-07-15 Sebastian Pop + + * graphite-clast-to-gimple.c (translate_clast_for_loop): Do not call + insert_loop_close_phis. + * sese.c (name_defined_in_loop_p): Removed. + (expr_defined_in_loop_p): Removed. + (alive_after_loop): Removed. + (close_phi_not_yet_inserted_p): Removed. + (struct alep): Removed. + (add_loop_exit_phis): Removed. + (insert_loop_close_phis): Removed. + 2010-07-15 Andreas Simbuerger - * graphite-cloog-util.c - (cloog_matrix_to_ppl_constraint): Fix flipped condition. - * graphite-poly.c - (psct_scattering_dim_for_loop_depth): Same. + * graphite-cloog-util.c (cloog_matrix_to_ppl_constraint): Fix flipped + condition. + * graphite-poly.c (psct_scattering_dim_for_loop_depth): Same. 2010-07-07 Sebastian Pop diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index f1d7475..80d602f 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -1044,10 +1044,6 @@ translate_clast_for_loop (sese region, loop_p context_loop, redirect_edge_succ_nodup (next_e, after); set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src); - /* Remove from rename_map all the tuples containing variables - defined in loop's body. */ - insert_loop_close_phis (rename_map, loop); - if (flag_loop_parallelize_all && !dependency_in_loop_p (loop, bb_pbb_mapping, get_scattering_level (level))) diff --git a/gcc/sese.c b/gcc/sese.c index a68ede5..420776d 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -888,173 +888,6 @@ get_false_edge_from_guard_bb (basic_block bb) return NULL; } -/* Returns true when NAME is defined in LOOP. */ - -static bool -name_defined_in_loop_p (tree name, loop_p loop) -{ - return !SSA_NAME_IS_DEFAULT_DEF (name) - && gimple_bb (SSA_NAME_DEF_STMT (name))->loop_father == loop; -} - -/* Returns true when EXPR contains SSA_NAMEs defined in LOOP. */ - -static bool -expr_defined_in_loop_p (tree expr, loop_p loop) -{ - switch (TREE_CODE_LENGTH (TREE_CODE (expr))) - { - case 3: - return expr_defined_in_loop_p (TREE_OPERAND (expr, 0), loop) - || expr_defined_in_loop_p (TREE_OPERAND (expr, 1), loop) - || expr_defined_in_loop_p (TREE_OPERAND (expr, 2), loop); - - case 2: - return expr_defined_in_loop_p (TREE_OPERAND (expr, 0), loop) - || expr_defined_in_loop_p (TREE_OPERAND (expr, 1), loop); - - case 1: - return expr_defined_in_loop_p (TREE_OPERAND (expr, 0), loop); - - case 0: - return TREE_CODE (expr) == SSA_NAME - && name_defined_in_loop_p (expr, loop); - - default: - return false; - } -} - -/* Returns the gimple statement that uses NAME outside the loop it is - defined in, returns NULL if there is no such loop close phi node. - An invariant of the loop closed SSA form is that the only use of a - variable, outside the loop it is defined in, is in the loop close - phi node that just follows the loop. */ - -static gimple -alive_after_loop (tree name) -{ - use_operand_p use_p; - imm_use_iterator imm_iter; - loop_p loop = gimple_bb (SSA_NAME_DEF_STMT (name))->loop_father; - - FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name) - { - gimple stmt = USE_STMT (use_p); - - if (gimple_code (stmt) == GIMPLE_PHI - && gimple_bb (stmt)->loop_father != loop) - return stmt; - } - - return NULL; -} - -/* Return true if a close phi has not yet been inserted for the use of - variable NAME on the single exit of LOOP. */ - -static bool -close_phi_not_yet_inserted_p (loop_p loop, tree name) -{ - gimple_stmt_iterator psi; - basic_block bb = single_exit (loop)->dest; - - for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi)) - if (gimple_phi_arg_def (gsi_stmt (psi), 0) == name) - return false; - - return true; -} - -/* A structure for passing parameters to add_loop_exit_phis. */ - -typedef struct alep { - loop_p loop; - VEC (rename_map_elt, heap) *new_renames; -} *alep_p; - -/* Helper function for htab_traverse in insert_loop_close_phis. */ - -static int -add_loop_exit_phis (void **slot, void *data) -{ - struct rename_map_elt_s *entry; - alep_p a; - loop_p loop; - tree expr, new_name, old_name; - bool def_in_loop_p, used_outside_p, need_close_phi_p; - gimple old_close_phi; - - if (!slot || !*slot || !data) - return 1; - - entry = (struct rename_map_elt_s *) *slot; - a = (alep_p) data; - loop = a->loop; - new_name = expr = entry->expr; - old_name = entry->old_name; - - def_in_loop_p = expr_defined_in_loop_p (expr, loop); - if (!def_in_loop_p) - return 1; - - /* Remove the old rename from the map when the expression is defined - in the loop that we're closing. */ - free (*slot); - *slot = NULL; - - if (TREE_CODE (expr) != SSA_NAME) - return 1; - - old_close_phi = alive_after_loop (old_name); - used_outside_p = (old_close_phi != NULL); - need_close_phi_p = (used_outside_p - && close_phi_not_yet_inserted_p (loop, new_name)); - - /* Insert a loop close phi node. */ - if (need_close_phi_p) - { - basic_block bb = single_exit (loop)->dest; - gimple phi = create_phi_node (new_name, bb); - tree new_res = create_new_def_for (gimple_phi_result (phi), phi, - gimple_phi_result_ptr (phi)); - - add_phi_arg (phi, new_name, single_pred_edge (bb), UNKNOWN_LOCATION); - VEC_safe_push (rename_map_elt, heap, a->new_renames, - new_rename_map_elt (gimple_phi_result (old_close_phi), - new_res)); - } - - return 1; -} - -/* Traverses MAP and removes from it all the tuples (OLD, NEW) where - NEW is defined in LOOP. Inserts on the exit of LOOP the close phi - node "RES = phi (NEW)" corresponding to "OLD_RES = phi (OLD)" in - the original code. Inserts in MAP the tuple (OLD_RES, RES). */ - -void -insert_loop_close_phis (htab_t map, loop_p loop) -{ - int i; - struct alep a; - rename_map_elt elt; - - a.loop = loop; - a.new_renames = VEC_alloc (rename_map_elt, heap, 3); - update_ssa (TODO_update_ssa); - htab_traverse (map, add_loop_exit_phis, &a); - update_ssa (TODO_update_ssa); - - for (i = 0; VEC_iterate (rename_map_elt, a.new_renames, i, elt); i++) - { - set_rename (map, elt->old_name, elt->expr); - free (elt); - } - - VEC_free (rename_map_elt, heap, a.new_renames); -} - /* Helper structure for htab_traverse in insert_guard_phis. */ struct igp { -- 1.7.0.4