From patchwork Tue Aug 24 16:17:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [3/4] Do not check whether memory references accessed in every iteration trap. Date: Tue, 24 Aug 2010 06:17:25 -0000 From: Sebastian Pop X-Patchwork-Id: 62608 Message-Id: To: Richard Guenther Cc: gcc-patches@gcc.gnu.org, matz@suse.de On Tue, Aug 24, 2010 at 10:11, Sebastian Pop wrote: > On Tue, Aug 24, 2010 at 05:00, Richard Guenther wrote: >> Now I just noticed that -ftree-loop-if-convert-memory-writes is long >> for -ftree-loop-if-convert-stores.  But I suppose it doesn't really > > This sounds much better, thanks for the suggestion. Here are the changes on top of the previous patches. Sebastian >From b72f67fe79aa1eca277c150a99c7d2e8210dd601 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Tue, 24 Aug 2010 11:12:29 -0500 Subject: [PATCH] Rename flag -ftree-loop-if-convert-stores. --- gcc/common.opt | 4 ++-- gcc/doc/invoke.texi | 2 +- gcc/tree-if-conv.c | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index bffc39b..675ca35 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -712,8 +712,8 @@ ftree-loop-if-convert Common Report Var(flag_tree_loop_if_convert) Init(-1) Optimization Convert conditional jumps in innermost loops to branchless equivalents -ftree-loop-if-convert-memory-writes -Common Report Var(flag_tree_loop_if_convert_memory_writes) Optimization +ftree-loop-if-convert-stores +Common Report Var(flag_tree_loop_if_convert_stores) Optimization Also if-convert conditional jumps containing memory writes ; -finhibit-size-directive inhibits output of .size for ELF. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 23559ba..7e069f0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6932,7 +6932,7 @@ the innermost loops in order to improve the ability of the vectorization pass to handle these loops. This is enabled by default if vectorization is enabled. -@item -ftree-loop-if-convert-memory-writes +@item -ftree-loop-if-convert-stores Attempt to also if-convert conditional jumps containing memory writes. This transformation can be unsafe for multi-threaded programs as it transforms conditional memory writes into unconditional memory writes. diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index cc06522..86b8f26 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -393,7 +393,7 @@ bb_with_exit_edge_p (struct loop *loop, basic_block bb) PHI is not if-convertible if: - it has more than 2 arguments. - When the flag_tree_loop_if_convert_memory_writes is not set, PHI is not + When the flag_tree_loop_if_convert_stores is not set, PHI is not if-convertible if: - a virtual PHI is immediately used in another PHI node, - there is a virtual PHI in a BB other than the loop->header. */ @@ -414,10 +414,10 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gimple phi) return false; } - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) return true; - /* When the flag_tree_loop_if_convert_memory_writes is not set, check + /* When the flag_tree_loop_if_convert_stores is not set, check that there are no memory writes in the branches of the loop to be if-converted. */ if (!is_gimple_reg (SSA_NAME_VAR (gimple_phi_result (phi)))) @@ -648,7 +648,7 @@ if_convertible_gimple_assign_stmt_p (gimple stmt, return false; } - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) { if (ifcvt_could_trap_p (stmt, refs)) { @@ -1013,7 +1013,7 @@ if_convertible_loop_p_1 (struct loop *loop, if (!res) return false; - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) { data_reference_p dr; @@ -1098,7 +1098,7 @@ if_convertible_loop_p (struct loop *loop) ddrs = VEC_alloc (ddr_p, heap, 25); res = if_convertible_loop_p_1 (loop, &refs, &ddrs); - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) { data_reference_p dr; unsigned int i; @@ -1335,7 +1335,7 @@ insert_gimplified_predicates (loop_p loop) stmts = bb_predicate_gimplified_stmts (bb); if (stmts) { - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) { /* Insert the predicate of the BB just after the label, as the if-conversion of memory writes will use this @@ -1561,7 +1561,7 @@ combine_blocks (struct loop *loop) insert_gimplified_predicates (loop); predicate_all_scalar_phis (loop); - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) predicate_mem_writes (loop); /* Merge basic blocks: first remove all the edges in the loop, @@ -1665,7 +1665,7 @@ tree_if_conversion (struct loop *loop) on-the-fly. */ combine_blocks (loop); - if (flag_tree_loop_if_convert_memory_writes) + if (flag_tree_loop_if_convert_stores) mark_sym_for_renaming (gimple_vop (cfun)); changed = true; @@ -1704,7 +1704,7 @@ main_tree_if_conversion (void) if (changed) todo |= TODO_cleanup_cfg; - if (changed && flag_tree_loop_if_convert_memory_writes) + if (changed && flag_tree_loop_if_convert_stores) todo |= TODO_update_ssa_only_virtuals; return todo; @@ -1717,7 +1717,7 @@ gate_tree_if_conversion (void) { return ((flag_tree_vectorize && flag_tree_loop_if_convert != 0) || flag_tree_loop_if_convert == 1 - || flag_tree_loop_if_convert_memory_writes == 1); + || flag_tree_loop_if_convert_stores == 1); } struct gimple_opt_pass pass_if_conversion = -- 1.7.0.4