From 58f10249a8182b1b038747113c2ba217d7bd4379 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 20 May 2016 09:01:23 +0000 Subject: [PATCH] tree-if-conv.c (add_bb_predicate_gimplified_stmts): Use gimple_seq_add_seq_without_update. 2016-05-20 Richard Biener * tree-if-conv.c (add_bb_predicate_gimplified_stmts): Use gimple_seq_add_seq_without_update. (release_bb_predicate): Assert we have no operands to free. (if_convertible_loop_p_1): Calculate post dominators later. Do not free BB predicates here. (combine_blocks): Do not recompute BB predicates. (version_loop_for_if_conversion): Save BB predicates around loop versioning. * gcc.dg/tree-ssa/ifc-cd.c: Adjust. From-SVN: r236498 --- gcc/ChangeLog | 11 +++++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c | 2 +- gcc/tree-if-conv.c | 25 ++++++++++++++++--------- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fed248d32e8..8471e8a01f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2016-05-20 Richard Biener + + * tree-if-conv.c (add_bb_predicate_gimplified_stmts): Use + gimple_seq_add_seq_without_update. + (release_bb_predicate): Assert we have no operands to free. + (if_convertible_loop_p_1): Calculate post dominators later. + Do not free BB predicates here. + (combine_blocks): Do not recompute BB predicates. + (version_loop_for_if_conversion): Save BB predicates around + loop versioning. + 2016-05-19 Segher Boessenkool * function.c (make_epilogue_seq): Remove epilogue_end parameter. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 41668728f07..0c2f4bc2dfe 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-05-20 Richard Biener + + * gcc.dg/tree-ssa/ifc-cd.c: Adjust. + 2016-05-19 Marek Polacek PR c++/71075 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c index f800f72cf69..29e2559e42b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c @@ -25,4 +25,4 @@ void foo (int *x1, int *x2, int *x3, int *x4, int *y) } } -/* { dg-final { scan-tree-dump-times "Use predicate of bb" 8 "ifcvt" } } */ +/* { dg-final { scan-tree-dump-times "Use predicate of bb" 4 "ifcvt" } } */ diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 8dc9a430f90..3bfa69cfb50 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -257,7 +257,7 @@ set_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts) static inline void add_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts) { - gimple_seq_add_seq + gimple_seq_add_seq_without_update (&(((struct bb_predicate *) bb->aux)->predicate_gimplified_stmts), stmts); } @@ -280,10 +280,11 @@ release_bb_predicate (basic_block bb) gimple_seq stmts = bb_predicate_gimplified_stmts (bb); if (stmts) { - gimple_stmt_iterator i; + if (flag_checking) + for (gimple_stmt_iterator i = gsi_start (stmts); + !gsi_end_p (i); gsi_next (&i)) + gcc_assert (! gimple_use_ops (gsi_stmt (i))); - for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i)) - free_stmt_operands (cfun, gsi_stmt (i)); set_bb_predicate_gimplified_stmts (bb, NULL); } } @@ -1322,7 +1323,6 @@ if_convertible_loop_p_1 (struct loop *loop, vec *refs) return false; calculate_dominance_info (CDI_DOMINATORS); - calculate_dominance_info (CDI_POST_DOMINATORS); /* Allow statements that can be handled during if-conversion. */ ifc_bbs = get_loop_body_in_if_conv_order (loop); @@ -1370,6 +1370,7 @@ if_convertible_loop_p_1 (struct loop *loop, vec *refs) = new hash_map; baseref_DR_map = new hash_map; + calculate_dominance_info (CDI_POST_DOMINATORS); predicate_bbs (loop); for (i = 0; refs->iterate (i, &dr); i++) @@ -1421,9 +1422,6 @@ if_convertible_loop_p_1 (struct loop *loop, vec *refs) return false; } - for (i = 0; i < loop->num_nodes; i++) - free_bb_predicate (ifc_bbs[i]); - /* Checking PHIs needs to be done after stmts, as the fact whether there are any masked loads or stores affects the tests. */ for (i = 0; i < loop->num_nodes; i++) @@ -2298,7 +2296,6 @@ combine_blocks (struct loop *loop) edge e; edge_iterator ei; - predicate_bbs (loop); remove_conditions_and_labels (loop); insert_gimplified_predicates (loop); predicate_all_scalar_phis (loop); @@ -2428,13 +2425,23 @@ version_loop_for_if_conversion (struct loop *loop) integer_zero_node); gimple_call_set_lhs (g, cond); + /* Save BB->aux around loop_version as that uses the same field. */ + void **saved_preds = XALLOCAVEC (void *, loop->num_nodes); + for (unsigned i = 0; i < loop->num_nodes; i++) + saved_preds[i] = ifc_bbs[i]->aux; + initialize_original_copy_tables (); new_loop = loop_version (loop, cond, &cond_bb, REG_BR_PROB_BASE, REG_BR_PROB_BASE, REG_BR_PROB_BASE, true); free_original_copy_tables (); + + for (unsigned i = 0; i < loop->num_nodes; i++) + ifc_bbs[i]->aux = saved_preds[i]; + if (new_loop == NULL) return false; + new_loop->dont_vectorize = true; new_loop->force_vectorize = false; gsi = gsi_last_bb (cond_bb); -- 2.30.2