summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-19 02:56:15 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-19 02:56:15 +0000
commita8a975337ad12d62805f07e4a3760db45de413c1 (patch)
tree62af4cc89d09878673cfb0755453089addf8f45e
parentd661eff24ccdd5896779471699cdf956f0311ccf (diff)
downloadgcc-a8a975337ad12d62805f07e4a3760db45de413c1.tar.gz
[PATCH] avail_expr_stack is no longer file scoped
PR tree-optimization/47679 * tree-ssa-dom.c (avail_exprs_stack): No longer file scoped. Move it here ... (dom_opt_dom_walker): New private member holding the avail_exprs_stack object. Update constructor. (pass_dominator::execute): Corresponding chagnes to declaration and initialization of avail_exprs_stack. Update constructor call for dom_opt_dom_walker object. (lookup_avail_expr, record_cond): Accept additional argument. Pass it down to children as needed. (record_equivalences_from_incoming_edge): Likewise. (eliminate_redundant_computations): Likewise. (record_equivalences_from_stmt): Likewise. (simplify_stmt_for_jump_threading): Likewise. (record_temporary_equivalences): Likewise. (optimize_stmt): Likewise. (dom_opt_dom_walker::thread_across_edge): Update access to avail_exprs_stack object and pass it to children as needed. (dom_opt_dom_walker::before_dom_children): Similarly. (dom_opt_dom_walker::after_dom_children): Similarly. * tree-ssa-threadedge.c (pfn_simplify): New typedef. (record_temporary_equivalences_from_stmts_at_dest): Use new typedef. Add avail_expr_stack argument. Pass it to children as needed. (dummy_simplify): Likewise. (simplify_control_stmt_condition): Likewise. (thread_around_empty_blocks): Likewise. (thread_through_normal_block): Likewise. (thread_across_edge): Likewise. * tree-ssa-threadedge.h (thread_across_edge): Update prototype. * tree-vrp.c (simplify_stmt_for_jump_threading): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227931 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog31
-rw-r--r--gcc/tree-ssa-dom.c123
-rw-r--r--gcc/tree-ssa-threadedge.c69
-rw-r--r--gcc/tree-ssa-threadedge.h2
-rw-r--r--gcc/tree-vrp.c3
5 files changed, 153 insertions, 75 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 475497713f4..4d0b1f5b4d4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,37 @@
2015-09-18 Jeff Law <law@redhat.com>
PR tree-optimization/47679
+ * tree-ssa-dom.c (avail_exprs_stack): No longer file scoped. Move
+ it here ...
+ (dom_opt_dom_walker): New private member holding the avail_exprs_stack
+ object. Update constructor.
+ (pass_dominator::execute): Corresponding chagnes to declaration
+ and initialization of avail_exprs_stack. Update constructor call
+ for dom_opt_dom_walker object.
+ (lookup_avail_expr, record_cond): Accept additional argument. Pass
+ it down to children as needed.
+ (record_equivalences_from_incoming_edge): Likewise.
+ (eliminate_redundant_computations): Likewise.
+ (record_equivalences_from_stmt): Likewise.
+ (simplify_stmt_for_jump_threading): Likewise.
+ (record_temporary_equivalences): Likewise.
+ (optimize_stmt): Likewise.
+ (dom_opt_dom_walker::thread_across_edge): Update access to
+ avail_exprs_stack object and pass it to children as needed.
+ (dom_opt_dom_walker::before_dom_children): Similarly.
+ (dom_opt_dom_walker::after_dom_children): Similarly.
+ * tree-ssa-threadedge.c (pfn_simplify): New typedef.
+ (record_temporary_equivalences_from_stmts_at_dest): Use new typedef.
+ Add avail_expr_stack argument. Pass it to children as needed.
+ (dummy_simplify): Likewise.
+ (simplify_control_stmt_condition): Likewise.
+ (thread_around_empty_blocks): Likewise.
+ (thread_through_normal_block): Likewise.
+ (thread_across_edge): Likewise.
+ * tree-ssa-threadedge.h (thread_across_edge): Update prototype.
+ * tree-vrp.c (simplify_stmt_for_jump_threading): Update.
+
+ PR tree-optimization/47679
* tree-ssa-dom.c (const_and_copies): No longer file scoped. Move
it here ...
(dom_opt_dom_walker): New private member holding the const_and_copies
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index fd2566c72dc..936af9919bc 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -78,9 +78,6 @@ struct edge_info
vec<cond_equivalence> cond_equivalences;
};
-/* Unwindable equivalences, both const/copy and expression varieties. */
-static avail_exprs_stack *avail_exprs_stack;
-
/* Track whether or not we have changed the control flow graph. */
static bool cfg_altered;
@@ -103,16 +100,20 @@ static struct opt_stats_d opt_stats;
/* Local functions. */
static void optimize_stmt (basic_block, gimple_stmt_iterator,
- class const_and_copies *);
-static tree lookup_avail_expr (gimple, bool);
-static void record_cond (cond_equivalence *);
+ class const_and_copies *,
+ class avail_exprs_stack *);
+static tree lookup_avail_expr (gimple, bool, class avail_exprs_stack *);
+static void record_cond (cond_equivalence *, class avail_exprs_stack *);
static void record_equality (tree, tree, class const_and_copies *);
static void record_equivalences_from_phis (basic_block);
static void record_equivalences_from_incoming_edge (basic_block,
- class const_and_copies *);
+ class const_and_copies *,
+ class avail_exprs_stack *);
static void eliminate_redundant_computations (gimple_stmt_iterator *,
- class const_and_copies *);
-static void record_equivalences_from_stmt (gimple, int);
+ class const_and_copies *,
+ class avail_exprs_stack *);
+static void record_equivalences_from_stmt (gimple, int,
+ class avail_exprs_stack *);
static edge single_incoming_edge_ignoring_loop_edges (basic_block);
static void dump_dominator_optimization_stats (FILE *file,
hash_table<expr_elt_hasher> *);
@@ -490,9 +491,11 @@ class dom_opt_dom_walker : public dom_walker
{
public:
dom_opt_dom_walker (cdi_direction direction,
- class const_and_copies *const_and_copies)
+ class const_and_copies *const_and_copies,
+ class avail_exprs_stack *avail_exprs_stack)
: dom_walker (direction),
m_const_and_copies (const_and_copies),
+ m_avail_exprs_stack (avail_exprs_stack),
m_dummy_cond (NULL) {}
virtual void before_dom_children (basic_block);
@@ -503,6 +506,7 @@ private:
/* Unwindable equivalences, both const/copy and expression varieties. */
class const_and_copies *m_const_and_copies;
+ class avail_exprs_stack *m_avail_exprs_stack;
gcond *m_dummy_cond;
};
@@ -550,7 +554,8 @@ pass_dominator::execute (function *fun)
/* Create our hash tables. */
hash_table<expr_elt_hasher> *avail_exprs
= new hash_table<expr_elt_hasher> (1024);
- avail_exprs_stack = new class avail_exprs_stack (avail_exprs);
+ class avail_exprs_stack *avail_exprs_stack
+ = new class avail_exprs_stack (avail_exprs);
class const_and_copies *const_and_copies = new class const_and_copies ();
need_eh_cleanup = BITMAP_ALLOC (NULL);
need_noreturn_fixup.create (0);
@@ -589,7 +594,9 @@ pass_dominator::execute (function *fun)
record_edge_info (bb);
/* Recursively walk the dominator tree optimizing statements. */
- dom_opt_dom_walker walker (CDI_DOMINATORS, const_and_copies);
+ dom_opt_dom_walker walker (CDI_DOMINATORS,
+ const_and_copies,
+ avail_exprs_stack);
walker.walk (fun->cfg->x_entry_block_ptr);
{
@@ -749,9 +756,10 @@ canonicalize_comparison (gcond *condstmt)
threading code with a simple API for simplifying statements. */
static tree
simplify_stmt_for_jump_threading (gimple stmt,
- gimple within_stmt ATTRIBUTE_UNUSED)
+ gimple within_stmt ATTRIBUTE_UNUSED,
+ class avail_exprs_stack *avail_exprs_stack)
{
- return lookup_avail_expr (stmt, false);
+ return lookup_avail_expr (stmt, false, avail_exprs_stack);
}
/* Valueize hook for gimple_fold_stmt_to_constant_1. */
@@ -768,13 +776,14 @@ dom_valueize (tree t)
return t;
}
-/* Record into the equivalence tables any equivalences implied by
- traversing edge E (which are cached in E->aux).
+/* Record into CONST_AND_COPIES and AVAIL_EXPRS_STACK any equivalences implied
+ by traversing edge E (which are cached in E->aux).
Callers are responsible for managing the unwinding markers. */
static void
record_temporary_equivalences (edge e,
- class const_and_copies *const_and_copies)
+ class const_and_copies *const_and_copies,
+ class avail_exprs_stack *avail_exprs_stack)
{
int i;
struct edge_info *edge_info = (struct edge_info *) e->aux;
@@ -861,7 +870,7 @@ record_temporary_equivalences (edge e,
/* 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);
+ record_cond (eq, avail_exprs_stack);
}
}
@@ -880,16 +889,16 @@ dom_opt_dom_walker::thread_across_edge (edge e)
/* Push a marker on both stacks so we can unwind the tables back to their
current state. */
- avail_exprs_stack->push_marker ();
+ m_avail_exprs_stack->push_marker ();
m_const_and_copies->push_marker ();
/* Traversing E may result in equivalences we can utilize. */
- record_temporary_equivalences (e, m_const_and_copies);
+ record_temporary_equivalences (e, m_const_and_copies, m_avail_exprs_stack);
/* With all the edge equivalences in the tables, go ahead and attempt
to thread through E->dest. */
::thread_across_edge (m_dummy_cond, e, false,
- m_const_and_copies, avail_exprs_stack,
+ m_const_and_copies, m_avail_exprs_stack,
simplify_stmt_for_jump_threading);
/* And restore the various tables to their state before
@@ -898,7 +907,7 @@ dom_opt_dom_walker::thread_across_edge (edge e)
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. */
- avail_exprs_stack->pop_to_marker ();
+ m_avail_exprs_stack->pop_to_marker ();
}
/* PHI nodes can create equivalences too.
@@ -989,12 +998,14 @@ single_incoming_edge_ignoring_loop_edges (basic_block bb)
return retval;
}
-/* Record any equivalences created by the incoming edge to BB. If BB
- has more than one incoming edge, then no equivalence is created. */
+/* Record any equivalences created by the incoming edge to BB into
+ CONST_AND_COPIES and AVAIL_EXPRS_STACK. If BB has more than one
+ incoming edge, then no equivalence is created. */
static void
record_equivalences_from_incoming_edge (basic_block bb,
- class const_and_copies *const_and_copies)
+ class const_and_copies *const_and_copies,
+ class avail_exprs_stack *avail_exprs_stack)
{
edge e;
basic_block parent;
@@ -1009,7 +1020,7 @@ record_equivalences_from_incoming_edge (basic_block bb,
/* If we had a single incoming edge from our parent block, then enter
any data associated with the edge into our tables. */
if (e && e->src == parent)
- record_temporary_equivalences (e, const_and_copies);
+ record_temporary_equivalences (e, const_and_copies, avail_exprs_stack);
}
/* Dump statistics for the hash table HTAB. */
@@ -1041,12 +1052,14 @@ dump_dominator_optimization_stats (FILE *file,
}
-/* Enter condition equivalence into the expression hash table.
+/* Enter condition equivalence P into AVAIL_EXPRS_HASH.
+
This indicates that a conditional expression has a known
boolean value. */
static void
-record_cond (cond_equivalence *p)
+record_cond (cond_equivalence *p,
+ class avail_exprs_stack *avail_exprs_stack)
{
class expr_hash_elt *element = new expr_hash_elt (&p->cond, p->value);
expr_hash_elt **slot;
@@ -1056,7 +1069,6 @@ record_cond (cond_equivalence *p)
if (*slot == NULL)
{
*slot = element;
-
avail_exprs_stack->record_expr (element, NULL, '1');
}
else
@@ -1280,10 +1292,11 @@ dom_opt_dom_walker::before_dom_children (basic_block bb)
/* Push a marker on the stacks of local information so that we know how
far to unwind when we finalize this block. */
- avail_exprs_stack->push_marker ();
+ m_avail_exprs_stack->push_marker ();
m_const_and_copies->push_marker ();
- record_equivalences_from_incoming_edge (bb, m_const_and_copies);
+ record_equivalences_from_incoming_edge (bb, m_const_and_copies,
+ m_avail_exprs_stack);
/* PHI nodes can create equivalences too. */
record_equivalences_from_phis (bb);
@@ -1291,13 +1304,14 @@ dom_opt_dom_walker::before_dom_children (basic_block bb)
/* Create equivalences from redundant PHIs. PHIs are only truly
redundant when they exist in the same block, so push another
marker and unwind right afterwards. */
- avail_exprs_stack->push_marker ();
+ m_avail_exprs_stack->push_marker ();
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- eliminate_redundant_computations (&gsi, m_const_and_copies);
- avail_exprs_stack->pop_to_marker ();
+ eliminate_redundant_computations (&gsi, m_const_and_copies,
+ m_avail_exprs_stack);
+ m_avail_exprs_stack->pop_to_marker ();
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- optimize_stmt (bb, gsi, m_const_and_copies);
+ optimize_stmt (bb, gsi, m_const_and_copies, m_avail_exprs_stack);
/* Now prepare to process dominated blocks. */
record_edge_info (bb);
@@ -1345,19 +1359,20 @@ dom_opt_dom_walker::after_dom_children (basic_block bb)
}
/* These remove expressions local to BB from the tables. */
- avail_exprs_stack->pop_to_marker ();
+ m_avail_exprs_stack->pop_to_marker ();
m_const_and_copies->pop_to_marker ();
}
/* Search for redundant computations in STMT. If any are found, then
replace them with the variable holding the result of the computation.
- If safe, record this expression into the available expression hash
- table. */
+ If safe, record this expression into AVAIL_EXPRS_STACK and
+ CONST_AND_COPIES. */
static void
eliminate_redundant_computations (gimple_stmt_iterator* gsi,
- class const_and_copies *const_and_copies)
+ class const_and_copies *const_and_copies,
+ class avail_exprs_stack *avail_exprs_stack)
{
tree expr_type;
tree cached_lhs;
@@ -1384,7 +1399,7 @@ eliminate_redundant_computations (gimple_stmt_iterator* gsi,
insert = false;
/* Check if the expression has been computed before. */
- cached_lhs = lookup_avail_expr (stmt, insert);
+ cached_lhs = lookup_avail_expr (stmt, insert, avail_exprs_stack);
opt_stats.num_exprs_considered++;
@@ -1459,12 +1474,14 @@ eliminate_redundant_computations (gimple_stmt_iterator* gsi,
/* STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either
the available expressions table or the const_and_copies table.
- Detect and record those equivalences. */
-/* We handle only very simple copy equivalences here. The heavy
+ Detect and record those equivalences into AVAIL_EXPRS_STACK.
+
+ We handle only very simple copy equivalences here. The heavy
lifing is done by eliminate_redundant_computations. */
static void
-record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
+record_equivalences_from_stmt (gimple stmt, int may_optimize_p,
+ class avail_exprs_stack *avail_exprs_stack)
{
tree lhs;
enum tree_code lhs_code;
@@ -1567,7 +1584,7 @@ record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
/* Finally enter the statement into the available expression
table. */
- lookup_avail_expr (new_stmt, true);
+ lookup_avail_expr (new_stmt, true, avail_exprs_stack);
}
}
@@ -1649,7 +1666,8 @@ cprop_into_stmt (gimple stmt)
cprop_operand (stmt, op_p);
}
-/* Optimize the statement pointed to by iterator SI.
+/* Optimize the statement in block BB pointed to by iterator SI
+ using equivalences from CONST_AND_COPIES and AVAIL_EXPRS_STACK.
We try to perform some simplistic global redundancy elimination and
constant propagation:
@@ -1666,7 +1684,8 @@ cprop_into_stmt (gimple stmt)
static void
optimize_stmt (basic_block bb, gimple_stmt_iterator si,
- class const_and_copies *const_and_copies)
+ class const_and_copies *const_and_copies,
+ class avail_exprs_stack *avail_exprs_stack)
{
gimple stmt, old_stmt;
bool may_optimize_p;
@@ -1756,7 +1775,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si,
}
update_stmt_if_modified (stmt);
- eliminate_redundant_computations (&si, const_and_copies);
+ eliminate_redundant_computations (&si, const_and_copies,
+ avail_exprs_stack);
stmt = gsi_stmt (si);
/* Perform simple redundant store elimination. */
@@ -1778,7 +1798,7 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si,
else
new_stmt = gimple_build_assign (rhs, lhs);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
- cached_lhs = lookup_avail_expr (new_stmt, false);
+ cached_lhs = lookup_avail_expr (new_stmt, false, avail_exprs_stack);
if (cached_lhs
&& rhs == cached_lhs)
{
@@ -1798,7 +1818,7 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si,
/* Record any additional equivalences created by this statement. */
if (is_gimple_assign (stmt))
- record_equivalences_from_stmt (stmt, may_optimize_p);
+ record_equivalences_from_stmt (stmt, may_optimize_p, avail_exprs_stack);
/* If STMT is a COND_EXPR and it was modified, then we may know
where it goes. If that is the case, then mark the CFG as altered.
@@ -1876,7 +1896,7 @@ vuse_eq (ao_ref *, tree vuse1, unsigned int cnt, void *data)
return NULL;
}
-/* Search for an existing instance of STMT in the AVAIL_EXPRS table.
+/* Search for an existing instance of STMT in the AVAIL_EXPRS_STACK table.
If found, return its LHS. Otherwise insert STMT in the table and
return NULL_TREE.
@@ -1885,7 +1905,8 @@ vuse_eq (ao_ref *, tree vuse1, unsigned int cnt, void *data)
we finish processing this block and its children. */
static tree
-lookup_avail_expr (gimple stmt, bool insert)
+lookup_avail_expr (gimple stmt, bool insert,
+ class avail_exprs_stack *avail_exprs_stack)
{
expr_hash_elt **slot;
tree lhs;
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 48c4ca765db..ba25e077679 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -56,6 +56,8 @@ static int stmt_count;
/* Array to record value-handles per SSA_NAME. */
vec<tree> ssa_name_values;
+typedef tree (pfn_simplify) (gimple, gimple, class avail_exprs_stack *);
+
/* Set the value for the SSA name NAME to VALUE. */
void
@@ -256,10 +258,10 @@ fold_assignment_stmt (gimple stmt)
static gimple
record_temporary_equivalences_from_stmts_at_dest (edge e,
- const_and_copies *const_and_copies,
- tree (*simplify) (gimple,
- gimple),
- bool backedge_seen)
+ const_and_copies *const_and_copies,
+ avail_exprs_stack *avail_exprs_stack,
+ pfn_simplify simplify,
+ bool backedge_seen)
{
gimple stmt = NULL;
gimple_stmt_iterator gsi;
@@ -412,7 +414,7 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
if (!cached_lhs
|| (TREE_CODE (cached_lhs) != SSA_NAME
&& !is_gimple_min_invariant (cached_lhs)))
- cached_lhs = (*simplify) (stmt, stmt);
+ cached_lhs = (*simplify) (stmt, stmt, avail_exprs_stack);
/* Restore the statement's original uses/defs. */
i = 0;
@@ -445,7 +447,8 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
necessarily valid. We use this callback rather than the ones provided by
DOM/VRP to achieve that effect. */
static tree
-dummy_simplify (gimple stmt1 ATTRIBUTE_UNUSED, gimple stmt2 ATTRIBUTE_UNUSED)
+dummy_simplify (gimple stmt1 ATTRIBUTE_UNUSED, gimple stmt2 ATTRIBUTE_UNUSED,
+ class avail_exprs_stack *avail_exprs_stack ATTRIBUTE_UNUSED)
{
return NULL_TREE;
}
@@ -459,13 +462,16 @@ dummy_simplify (gimple stmt1 ATTRIBUTE_UNUSED, gimple stmt2 ATTRIBUTE_UNUSED)
a condition using pass specific information.
Return the simplified condition or NULL if simplification could
- not be performed. */
+ not be performed.
+
+ The available expression table is referenced via AVAIL_EXPRS_STACK. */
static tree
simplify_control_stmt_condition (edge e,
gimple stmt,
+ class avail_exprs_stack *avail_exprs_stack,
gcond *dummy_cond,
- tree (*simplify) (gimple, gimple),
+ pfn_simplify simplify,
bool handle_dominating_asserts)
{
tree cond, cached_lhs;
@@ -552,7 +558,7 @@ simplify_control_stmt_condition (edge e,
then use the pass specific callback to simplify the condition. */
if (!cached_lhs
|| !is_gimple_min_invariant (cached_lhs))
- cached_lhs = (*simplify) (dummy_cond, stmt);
+ cached_lhs = (*simplify) (dummy_cond, stmt, avail_exprs_stack);
/* If we were just testing that an integral type was != 0, and that
failed, just return the first operand. This gives the FSM code a
@@ -614,7 +620,7 @@ simplify_control_stmt_condition (edge e,
/* If we haven't simplified to an invariant yet, then use the
pass specific callback to try and simplify it further. */
if (cached_lhs && ! is_gimple_min_invariant (cached_lhs))
- cached_lhs = (*simplify) (stmt, stmt);
+ cached_lhs = (*simplify) (stmt, stmt, avail_exprs_stack);
/* We couldn't find an invariant. But, callers of this
function may be able to do something useful with the
@@ -764,12 +770,16 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
return false.
DUMMY_COND, HANDLE_DOMINATING_ASSERTS and SIMPLIFY are used to
- try and simplify the condition at the end of TAKEN_EDGE->dest. */
+ try and simplify the condition at the end of TAKEN_EDGE->dest.
+
+ The available expression table is referenced via AVAIL_EXPRS_STACK. */
+
static bool
thread_around_empty_blocks (edge taken_edge,
gcond *dummy_cond,
+ class avail_exprs_stack *avail_exprs_stack,
bool handle_dominating_asserts,
- tree (*simplify) (gimple, gimple),
+ pfn_simplify simplify,
bitmap visited,
vec<jump_thread_edge *> *path,
bool *backedge_seen_p)
@@ -818,6 +828,7 @@ thread_around_empty_blocks (edge taken_edge,
simplify = dummy_simplify;
return thread_around_empty_blocks (taken_edge,
dummy_cond,
+ avail_exprs_stack,
handle_dominating_asserts,
simplify,
visited,
@@ -846,7 +857,8 @@ thread_around_empty_blocks (edge taken_edge,
simplify = dummy_simplify;
/* Extract and simplify the condition. */
- cond = simplify_control_stmt_condition (taken_edge, stmt, dummy_cond,
+ cond = simplify_control_stmt_condition (taken_edge, stmt,
+ avail_exprs_stack, dummy_cond,
simplify, handle_dominating_asserts);
/* If the condition can be statically computed and we have not already
@@ -869,6 +881,7 @@ thread_around_empty_blocks (edge taken_edge,
thread_around_empty_blocks (taken_edge,
dummy_cond,
+ avail_exprs_stack,
handle_dominating_asserts,
simplify,
visited,
@@ -1187,7 +1200,8 @@ thread_through_normal_block (edge e,
gcond *dummy_cond,
bool handle_dominating_asserts,
const_and_copies *const_and_copies,
- tree (*simplify) (gimple, gimple),
+ avail_exprs_stack *avail_exprs_stack,
+ pfn_simplify simplify,
vec<jump_thread_edge *> *path,
bitmap visited,
bool *backedge_seen_p)
@@ -1210,6 +1224,7 @@ thread_through_normal_block (edge e,
temporary equivalences we can detect. */
gimple stmt
= record_temporary_equivalences_from_stmts_at_dest (e, const_and_copies,
+ avail_exprs_stack,
simplify,
*backedge_seen_p);
@@ -1248,7 +1263,8 @@ thread_through_normal_block (edge e,
tree cond;
/* Extract and simplify the condition. */
- cond = simplify_control_stmt_condition (e, stmt, dummy_cond, simplify,
+ cond = simplify_control_stmt_condition (e, stmt, avail_exprs_stack,
+ dummy_cond, simplify,
handle_dominating_asserts);
if (!cond)
@@ -1293,6 +1309,7 @@ thread_through_normal_block (edge e,
bitmap_set_bit (visited, e->dest->index);
thread_around_empty_blocks (taken_edge,
dummy_cond,
+ avail_exprs_stack,
handle_dominating_asserts,
simplify,
visited,
@@ -1348,8 +1365,10 @@ thread_through_normal_block (edge e,
the simplified condition with left-hand sides of ASSERT_EXPRs they are
used in.
- STACK is used to undo temporary equivalences created during the walk of
- E->dest.
+ CONST_AND_COPIES is used to undo temporary equivalences created during the
+ walk of E->dest.
+
+ The available expression table is referenced vai AVAIL_EXPRS_STACK.
SIMPLIFY is a pass-specific function used to simplify statements. */
@@ -1357,9 +1376,10 @@ void
thread_across_edge (gcond *dummy_cond,
edge e,
bool handle_dominating_asserts,
- const_and_copies *const_and_copies,
- avail_exprs_stack *avail_exprs_stack,
- tree (*simplify) (gimple, gimple))
+ class const_and_copies *const_and_copies,
+ class avail_exprs_stack *avail_exprs_stack,
+ tree (*simplify) (gimple, gimple,
+ class avail_exprs_stack *))
{
bitmap visited = BITMAP_ALLOC (NULL);
bool backedge_seen;
@@ -1376,7 +1396,9 @@ thread_across_edge (gcond *dummy_cond,
int threaded = thread_through_normal_block (e, dummy_cond,
handle_dominating_asserts,
- const_and_copies, simplify, path,
+ const_and_copies,
+ avail_exprs_stack,
+ simplify, path,
visited, &backedge_seen);
if (threaded > 0)
{
@@ -1467,6 +1489,7 @@ thread_across_edge (gcond *dummy_cond,
simplify = dummy_simplify;
found = thread_around_empty_blocks (taken_edge,
dummy_cond,
+ avail_exprs_stack,
handle_dominating_asserts,
simplify,
visited,
@@ -1479,7 +1502,9 @@ thread_across_edge (gcond *dummy_cond,
if (!found)
found = thread_through_normal_block (path->last ()->e, dummy_cond,
handle_dominating_asserts,
- const_and_copies, simplify, path,
+ const_and_copies,
+ avail_exprs_stack,
+ simplify, path,
visited, &backedge_seen) > 0;
/* If we were able to thread through a successor of E->dest, then
diff --git a/gcc/tree-ssa-threadedge.h b/gcc/tree-ssa-threadedge.h
index 0def2e0103f..023b0f791d9 100644
--- a/gcc/tree-ssa-threadedge.h
+++ b/gcc/tree-ssa-threadedge.h
@@ -33,6 +33,6 @@ extern void propagate_threaded_block_debug_into (basic_block, basic_block);
extern void thread_across_edge (gcond *, edge, bool,
const_and_copies *,
avail_exprs_stack *,
- tree (*) (gimple, gimple));
+ tree (*) (gimple, gimple, avail_exprs_stack *));
#endif /* GCC_TREE_SSA_THREADEDGE_H */
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 5e813906ac7..cfb832916e4 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -10066,7 +10066,8 @@ const_and_copies *equiv_stack;
for any overflow warnings. */
static tree
-simplify_stmt_for_jump_threading (gimple stmt, gimple within_stmt)
+simplify_stmt_for_jump_threading (gimple stmt, gimple within_stmt,
+ class avail_exprs_stack *avail_exprs_stack ATTRIBUTE_UNUSED)
{
if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))
return vrp_evaluate_conditional (gimple_cond_code (cond_stmt),