aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2013-09-19 06:49:30 -0600
committerJeff Law <law@gcc.gnu.org>2013-09-19 06:49:30 -0600
commit83ae86f5b7671f22d7fc3581c3632f92537eb539 (patch)
treed9966b2e81e1393d616bc1fd828dce5251d36415 /gcc
parent9d5321624b105f7f265254568ecab29e330e1ec7 (diff)
downloadgcc-83ae86f5b7671f22d7fc3581c3632f92537eb539.zip
gcc-83ae86f5b7671f22d7fc3581c3632f92537eb539.tar.gz
gcc-83ae86f5b7671f22d7fc3581c3632f92537eb539.tar.bz2
tree-ssa-dom.c (record_temporary_equivalences): New function split out of dom_opt_dom_walker::after_dom_children.
* tree-ssa-dom.c (record_temporary_equivalences): New function split out of dom_opt_dom_walker::after_dom_children. (dom_opt_dom_walker::thread_across_edge): Move common code in here from dom_opt_dom_walker::after_dom_children. (dom_opt_dom_walker::after_dom_children): Corresponding simplifictions. From-SVN: r202742
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-ssa-dom.c116
2 files changed, 54 insertions, 70 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3fa40f6..0f73b07 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2013-09-17 Jeff Law <law@redhat.com>
+
+ * tree-ssa-dom.c (record_temporary_equivalences): New function
+ split out of dom_opt_dom_walker::after_dom_children.
+ (dom_opt_dom_walker::thread_across_edge): Move common code
+ in here from dom_opt_dom_walker::after_dom_children.
+ (dom_opt_dom_walker::after_dom_children): Corresponding simplifictions.
+
2013-09-19 Jan Hubicka <jh@suse.cz>
* i386.h (TARGET_GENERIC32, TARGET_GENERIC64): Remove.
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index aac7aa4..f561386 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1070,6 +1070,31 @@ simplify_stmt_for_jump_threading (gimple stmt,
return lookup_avail_expr (stmt, false);
}
+static void
+record_temporary_equivalences (edge e)
+{
+ int i;
+ struct edge_info *edge_info = (struct edge_info *) e->aux;
+
+ /* If we have info associated with this edge, record it into
+ our equivalence tables. */
+ if (edge_info)
+ {
+ cond_equivalence *eq;
+ tree lhs = edge_info->lhs;
+ tree rhs = edge_info->rhs;
+
+ /* If we have a simple NAME = VALUE equivalence, record it. */
+ if (lhs && TREE_CODE (lhs) == SSA_NAME)
+ record_const_or_copy (lhs, rhs);
+
+ /* If we have 0 = COND or 1 = COND equivalences, record them
+ into our expression hash tables. */
+ for (i = 0; edge_info->cond_equivalences.iterate (i, &eq); ++i)
+ record_cond (eq);
+ }
+}
+
/* Wrapper for common code to attempt to thread an edge. For example,
it handles lazily building the dummy condition and the bookkeeping
when jump threading is successful. */
@@ -1083,9 +1108,27 @@ dom_opt_dom_walker::thread_across_edge (edge e)
integer_zero_node, integer_zero_node,
NULL, NULL);
+ /* Push a marker on both stacks so we can unwind the tables back to their
+ current state. */
+ avail_exprs_stack.safe_push (NULL);
+ const_and_copies_stack.safe_push (NULL_TREE);
+
+ /* Traversing E may result in equivalences we can utilize. */
+ record_temporary_equivalences (e);
+
+ /* With all the edge equivalences in the tables, go ahead and attempt
+ to thread through E->dest. */
::thread_across_edge (dummy_cond_, e, false,
&const_and_copies_stack,
simplify_stmt_for_jump_threading);
+
+ /* And restore the various tables to their state before
+ we threaded this edge.
+
+ XXX The code in tree-ssa-threadedge.c will restore the state of
+ the const_and_copies table. We we just have to restore the expression
+ table. */
+ remove_local_expressions_from_table ();
}
/* PHI nodes can create equivalences too.
@@ -1905,9 +1948,6 @@ dom_opt_dom_walker::after_dom_children (basic_block bb)
&& (single_succ_edge (bb)->flags & EDGE_ABNORMAL) == 0
&& potentially_threadable_block (single_succ (bb)))
{
- /* Push a marker on the stack, which thread_across_edge expects
- and will remove. */
- const_and_copies_stack.safe_push (NULL_TREE);
thread_across_edge (single_succ_edge (bb));
}
else if ((last = last_stmt (bb))
@@ -1923,79 +1963,15 @@ dom_opt_dom_walker::after_dom_children (basic_block bb)
/* Only try to thread the edge if it reaches a target block with
more than one predecessor and more than one successor. */
if (potentially_threadable_block (true_edge->dest))
- {
- struct edge_info *edge_info;
- unsigned int i;
-
- /* Push a marker onto the available expression stack so that we
- unwind any expressions related to the TRUE arm before processing
- the false arm below. */
- avail_exprs_stack.safe_push (NULL);
- const_and_copies_stack.safe_push (NULL_TREE);
-
- edge_info = (struct edge_info *) true_edge->aux;
-
- /* If we have info associated with this edge, record it into
- our equivalence tables. */
- if (edge_info)
- {
- cond_equivalence *eq;
- tree lhs = edge_info->lhs;
- tree rhs = edge_info->rhs;
-
- /* If we have a simple NAME = VALUE equivalence, record it. */
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- record_const_or_copy (lhs, rhs);
-
- /* If we have 0 = COND or 1 = COND equivalences, record them
- into our expression hash tables. */
- for (i = 0; edge_info->cond_equivalences.iterate (i, &eq); ++i)
- record_cond (eq);
- }
-
- thread_across_edge (true_edge);
-
- /* And restore the various tables to their state before
- we threaded this edge. */
- remove_local_expressions_from_table ();
- }
+ thread_across_edge (true_edge);
/* Similarly for the ELSE arm. */
if (potentially_threadable_block (false_edge->dest))
- {
- struct edge_info *edge_info;
- unsigned int i;
-
- const_and_copies_stack.safe_push (NULL_TREE);
- edge_info = (struct edge_info *) false_edge->aux;
-
- /* If we have info associated with this edge, record it into
- our equivalence tables. */
- if (edge_info)
- {
- cond_equivalence *eq;
- tree lhs = edge_info->lhs;
- tree rhs = edge_info->rhs;
-
- /* If we have a simple NAME = VALUE equivalence, record it. */
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- record_const_or_copy (lhs, rhs);
-
- /* If we have 0 = COND or 1 = COND equivalences, record them
- into our expression hash tables. */
- for (i = 0; edge_info->cond_equivalences.iterate (i, &eq); ++i)
- record_cond (eq);
- }
+ thread_across_edge (false_edge);
- /* Now thread the edge. */
- thread_across_edge (false_edge);
-
- /* No need to remove local expressions from our tables
- or restore vars to their original value as that will
- be done immediately below. */
- }
}
+ /* These remove expressions local to BB from the tables. */
remove_local_expressions_from_table ();
restore_vars_to_original_value ();
}