diff options
author | Jeff Law <law@redhat.com> | 2017-03-16 13:21:33 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-03-16 13:21:33 -0600 |
commit | c87550223ac148a5c50b7b3c785ef1f1f5ffd3ac (patch) | |
tree | 2015d481070a9147dbdeef1dd1ffd15cc2a515b3 /gcc/tree-ssa-dom.c | |
parent | 8d7437be4725af093548429f6e4c80a7867cdb41 (diff) | |
download | gcc-c87550223ac148a5c50b7b3c785ef1f1f5ffd3ac.zip gcc-c87550223ac148a5c50b7b3c785ef1f1f5ffd3ac.tar.gz gcc-c87550223ac148a5c50b7b3c785ef1f1f5ffd3ac.tar.bz2 |
re PR tree-optimization/71437 (Performance regression after r235817)
PR tree-optimization/71437
* tree-ssa-dom.c (dom_opt_dom_walker): Remove thread_across_edge
member function. Implementation moved into after_dom_children
member function and into the threader's thread_outgoing_edges
function.
(dom_opt_dom_walker::after_dom_children): Simplify by moving
some code into new thread_outgoing_edges.
* tree-ssa-threadedge.c (thread_across_edge): Make static and simplify
definition. Simplify marker handling (do it here). Assume we always
have the available expression and the const/copies tables.
(thread_outgoing_edges): New function extracted from tree-ssa-dom.c
and tree-vrp.c
* tree-ssa-threadedge.h (thread_outgoing_edges): Declare.
* tree-vrp.c (equiv_stack): No longer file scoped.
(vrp_dom_walker): New class.
(vrp_dom_walker::before_dom_children): New member function.
(vrp_dom_walker::after_dom_children): Likewise.
(identify_jump_threads): Setup domwalker. Use it rather than
walking edges in a random order by hand. Simplify setup/finalization.
(finalize_jump_threads): Remove.
(vrp_finalize): Do not call identify_jump_threads here.
(execute_vrp): Do it here instead and call thread_through_all_blocks
here too.
From-SVN: r246208
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r-- | gcc/tree-ssa-dom.c | 71 |
1 files changed, 6 insertions, 65 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 32468e9..c6ffc38 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -350,7 +350,6 @@ public: virtual void after_dom_children (basic_block); private: - void thread_across_edge (edge); /* Unwindable equivalences, both const/copy and expression varieties. */ class const_and_copies *m_const_and_copies; @@ -816,39 +815,6 @@ record_temporary_equivalences (edge e, } } -/* 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. */ - -void -dom_opt_dom_walker::thread_across_edge (edge e) -{ - if (! m_dummy_cond) - m_dummy_cond = - gimple_build_cond (NE_EXPR, - 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. */ - m_avail_exprs_stack->push_marker (); - m_const_and_copies->push_marker (); - - /* With all the edge equivalences in the tables, go ahead and attempt - to thread through E->dest. */ - ::thread_across_edge (m_dummy_cond, e, - m_const_and_copies, m_avail_exprs_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. */ - m_avail_exprs_stack->pop_to_marker (); -} - /* PHI nodes can create equivalences too. Ignoring any alternatives which are the same as the result, if @@ -1224,38 +1190,13 @@ dom_opt_dom_walker::before_dom_children (basic_block bb) void dom_opt_dom_walker::after_dom_children (basic_block bb) { - gimple *last; - - /* If we have an outgoing edge to a block with multiple incoming and - outgoing edges, then we may be able to thread the edge, i.e., we - may be able to statically determine which of the outgoing edges - will be traversed when the incoming edge from BB is traversed. */ - if (single_succ_p (bb) - && (single_succ_edge (bb)->flags & EDGE_ABNORMAL) == 0 - && potentially_threadable_block (single_succ (bb))) - { - thread_across_edge (single_succ_edge (bb)); - } - else if ((last = last_stmt (bb)) - && gimple_code (last) == GIMPLE_COND - && EDGE_COUNT (bb->succs) == 2 - && (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL) == 0 - && (EDGE_SUCC (bb, 1)->flags & EDGE_ABNORMAL) == 0) - { - edge true_edge, false_edge; - - extract_true_false_edges_from_block (bb, &true_edge, &false_edge); - - /* 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)) - thread_across_edge (true_edge); - - /* Similarly for the ELSE arm. */ - if (potentially_threadable_block (false_edge->dest)) - thread_across_edge (false_edge); + if (! m_dummy_cond) + m_dummy_cond = gimple_build_cond (NE_EXPR, integer_zero_node, + integer_zero_node, NULL, NULL); - } + thread_outgoing_edges (bb, m_dummy_cond, m_const_and_copies, + m_avail_exprs_stack, + simplify_stmt_for_jump_threading); /* These remove expressions local to BB from the tables. */ m_avail_exprs_stack->pop_to_marker (); |