aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Ellcey <sellcey@imgtec.com>2013-05-16 17:09:40 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2013-05-16 17:09:40 +0000
commitf14540b6352b1a164ef79ae36d1ae1463efdac46 (patch)
tree0417eb55c06e17bb692b965567279eb2722fc0d5
parent45f9820f0075149dcbbe71eac97bf31993e9f9df (diff)
downloadgcc-f14540b6352b1a164ef79ae36d1ae1463efdac46.zip
gcc-f14540b6352b1a164ef79ae36d1ae1463efdac46.tar.gz
gcc-f14540b6352b1a164ef79ae36d1ae1463efdac46.tar.bz2
cfghooks.c (copy_bbs): Add update_dominance argument.
2013-05-16 Steve Ellcey <sellcey@imgtec.com> * cfghooks.c (copy_bbs): Add update_dominance argument. * cfghooks.h (copy_bbs): Update prototype. * tree-cfg.c (gimple_duplicate_sese_region): Add update_dominance argument. * tree-flow.h (gimple_duplicate_sese_region): Update prototype. * tree-ssa-loop-ch.c (copy_loop_headers): Update gimple_duplicate_sese_region call. * tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg): Update copy_bbs call. * cfgloopmanip.c (duplicate_loop_to_header_edge): Ditto. * trans-mem.c (ipa_uninstrument_transaction): Ditto. From-SVN: r198980
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cfghooks.c38
-rw-r--r--gcc/cfghooks.h2
-rw-r--r--gcc/cfgloopmanip.c2
-rw-r--r--gcc/trans-mem.c3
-rw-r--r--gcc/tree-cfg.c37
-rw-r--r--gcc/tree-flow.h2
-rw-r--r--gcc/tree-ssa-loop-ch.c3
-rw-r--r--gcc/tree-vect-loop-manip.c2
9 files changed, 68 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1c70cb1..615c233 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2013-05-16 Steve Ellcey <sellcey@imgtec.com>
+
+ * cfghooks.c (copy_bbs): Add update_dominance argument.
+ * cfghooks.h (copy_bbs): Update prototype.
+ * tree-cfg.c (gimple_duplicate_sese_region):
+ Add update_dominance argument.
+ * tree-flow.h (gimple_duplicate_sese_region): Update prototype.
+ * tree-ssa-loop-ch.c (copy_loop_headers): Update
+ gimple_duplicate_sese_region call.
+ * tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg):
+ Update copy_bbs call.
+ * cfgloopmanip.c (duplicate_loop_to_header_edge): Ditto.
+ * trans-mem.c (ipa_uninstrument_transaction): Ditto.
+
2013-05-16 Jakub Jelinek <jakub@redhat.com>
* tree-vectorizer.h (NUM_PATTERNS): Increment.
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 22b962b..8331fa0 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -1282,12 +1282,17 @@ end:
/* Duplicates N basic blocks stored in array BBS. Newly created basic blocks
are placed into array NEW_BBS in the same order. Edges from basic blocks
- in BBS are also duplicated and copies of those of them
- that lead into BBS are redirected to appropriate newly created block. The
- function assigns bbs into loops (copy of basic block bb is assigned to
- bb->loop_father->copy loop, so this must be set up correctly in advance)
- and updates dominators locally (LOOPS structure that contains the information
- about dominators is passed to enable this).
+ in BBS are also duplicated and copies of those that lead into BBS are
+ redirected to appropriate newly created block. The function assigns bbs
+ into loops (copy of basic block bb is assigned to bb->loop_father->copy
+ loop, so this must be set up correctly in advance)
+
+ If UPDATE_DOMINANCE is true then this function updates dominators locally
+ (LOOPS structure that contains the information about dominators is passed
+ to enable this), otherwise it does not update the dominator information
+ and it assumed that the caller will do this, perhaps by destroying and
+ recreating it instead of trying to do an incremental update like this
+ function does when update_dominance is true.
BASE is the superloop to that basic block belongs; if its header or latch
is copied, we do not set the new blocks as header or latch.
@@ -1301,7 +1306,7 @@ end:
void
copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
edge *edges, unsigned num_edges, edge *new_edges,
- struct loop *base, basic_block after)
+ struct loop *base, basic_block after, bool update_dominance)
{
unsigned i, j;
basic_block bb, new_bb, dom_bb;
@@ -1327,16 +1332,19 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
}
/* Set dominators. */
- for (i = 0; i < n; i++)
+ if (update_dominance)
{
- bb = bbs[i];
- new_bb = new_bbs[i];
-
- dom_bb = get_immediate_dominator (CDI_DOMINATORS, bb);
- if (dom_bb->flags & BB_DUPLICATED)
+ for (i = 0; i < n; i++)
{
- dom_bb = get_bb_copy (dom_bb);
- set_immediate_dominator (CDI_DOMINATORS, new_bb, dom_bb);
+ bb = bbs[i];
+ new_bb = new_bbs[i];
+
+ dom_bb = get_immediate_dominator (CDI_DOMINATORS, bb);
+ if (dom_bb->flags & BB_DUPLICATED)
+ {
+ dom_bb = get_bb_copy (dom_bb);
+ set_immediate_dominator (CDI_DOMINATORS, new_bb, dom_bb);
+ }
}
}
diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h
index bff0a0c..ec595a5 100644
--- a/gcc/cfghooks.h
+++ b/gcc/cfghooks.h
@@ -201,7 +201,7 @@ extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block,
extern bool can_copy_bbs_p (basic_block *, unsigned);
extern void copy_bbs (basic_block *, unsigned, basic_block *,
edge *, unsigned, edge *, struct loop *,
- basic_block);
+ basic_block, bool);
void account_profile_record (struct profile_record *, int);
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 9581677..bc87755 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -1300,7 +1300,7 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e,
/* Copy bbs. */
copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop,
- place_after);
+ place_after, true);
place_after = new_spec_edges[SE_LATCH]->src;
if (flags & DLTHE_RECORD_COPY_NUMBER)
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 5cb8286..c66278c 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -3978,7 +3978,8 @@ ipa_uninstrument_transaction (struct tm_region *region,
int n = queue.length ();
basic_block *new_bbs = XNEWVEC (basic_block, n);
- copy_bbs (queue.address (), n, new_bbs, NULL, 0, NULL, NULL, transaction_bb);
+ copy_bbs (queue.address (), n, new_bbs, NULL, 0, NULL, NULL, transaction_bb,
+ true);
edge e = make_edge (transaction_bb, new_bbs[0], EDGE_TM_UNINSTRUMENTED);
add_phi_args_after_copy (new_bbs, n, e);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index a08a737..721c4f7 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -5686,16 +5686,19 @@ add_phi_args_after_copy (basic_block *region_copy, unsigned n_region,
inside region is live over the other exit edges of the region. All entry
edges to the region must go to ENTRY->dest. The edge ENTRY is redirected
to the duplicate of the region. Dominance and loop information is
- updated, but not the SSA web. The new basic blocks are stored to
- REGION_COPY in the same order as they had in REGION, provided that
- REGION_COPY is not NULL.
+ updated if UPDATE_DOMINANCE is true, but not the SSA web. If
+ UPDATE_DOMINANCE is false then we assume that the caller will update the
+ dominance information after calling this function. The new basic
+ blocks are stored to REGION_COPY in the same order as they had in REGION,
+ provided that REGION_COPY is not NULL.
The function returns false if it is unable to copy the region,
true otherwise. */
bool
gimple_duplicate_sese_region (edge entry, edge exit,
basic_block *region, unsigned n_region,
- basic_block *region_copy)
+ basic_block *region_copy,
+ bool update_dominance)
{
unsigned i;
bool free_region_copy = false, copying_header = false;
@@ -5749,12 +5752,15 @@ gimple_duplicate_sese_region (edge entry, edge exit,
free_region_copy = true;
}
- /* Record blocks outside the region that are dominated by something
- inside. */
- doms.create (0);
initialize_original_copy_tables ();
- doms = get_dominated_by_region (CDI_DOMINATORS, region, n_region);
+ /* Record blocks outside the region that are dominated by something
+ inside. */
+ if (update_dominance)
+ {
+ doms.create (0);
+ doms = get_dominated_by_region (CDI_DOMINATORS, region, n_region);
+ }
if (entry->dest->count)
{
@@ -5778,7 +5784,7 @@ gimple_duplicate_sese_region (edge entry, edge exit,
}
copy_bbs (region, n_region, region_copy, &exit, 1, &exit_copy, loop,
- split_edge_bb_loc (entry));
+ split_edge_bb_loc (entry), update_dominance);
if (total_count)
{
scale_bbs_frequencies_gcov_type (region, n_region,
@@ -5809,10 +5815,13 @@ gimple_duplicate_sese_region (edge entry, edge exit,
for entry block and its copy. Anything that is outside of the
region, but was dominated by something inside needs recounting as
well. */
- set_immediate_dominator (CDI_DOMINATORS, entry->dest, entry->src);
- doms.safe_push (get_bb_original (entry->dest));
- iterate_fix_dominators (CDI_DOMINATORS, doms, false);
- doms.release ();
+ if (update_dominance)
+ {
+ set_immediate_dominator (CDI_DOMINATORS, entry->dest, entry->src);
+ doms.safe_push (get_bb_original (entry->dest));
+ iterate_fix_dominators (CDI_DOMINATORS, doms, false);
+ doms.release ();
+ }
/* Add the other PHI node arguments. */
add_phi_args_after_copy (region_copy, n_region, NULL);
@@ -5944,7 +5953,7 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU
}
copy_bbs (region, n_region, region_copy, exits, 2, nexits, orig_loop,
- split_edge_bb_loc (exit));
+ split_edge_bb_loc (exit), true);
if (total_count)
{
scale_bbs_frequencies_gcov_type (region, n_region,
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 01fe363..24fcfbf 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -395,7 +395,7 @@ extern void verify_gimple_in_cfg (struct function *);
extern tree gimple_block_label (basic_block);
extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
- basic_block *);
+ basic_block *, bool);
extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
basic_block *);
extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit,
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index a1d0299..ff17c7e 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -197,7 +197,8 @@ copy_loop_headers (void)
entry = loop_preheader_edge (loop);
propagate_threaded_block_debug_into (exit->dest, entry->dest);
- if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs))
+ if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs,
+ true))
{
fprintf (dump_file, "Duplication failed.\n");
continue;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index a0d6769..12f70ee 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -735,7 +735,7 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e)
copy_bbs (bbs, loop->num_nodes + 1, new_bbs,
&exit, 1, &new_exit, NULL,
- e->src);
+ e->src, true);
basic_block new_preheader = new_bbs[loop->num_nodes];
add_phi_args_after_copy (new_bbs, loop->num_nodes + 1, NULL);