[gcc(refs/users/aldyh/heads/threader-refactor)] wip wip
Aldy Hernandez
aldyh@gcc.gnu.org
Wed Nov 25 14:50:17 GMT 2020
https://gcc.gnu.org/g:9b3737d25df93f299f5f8d6d35a4a95b27453597
commit 9b3737d25df93f299f5f8d6d35a4a95b27453597
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Tue Nov 24 10:48:45 2020 +0100
wip wip
Diff:
---
gcc/tree-ssa-dom.c | 19 +++++++++++--------
gcc/tree-ssa-threadedge.c | 12 ++++--------
gcc/tree-ssa-threadedge.h | 10 ++++++++--
gcc/tree-vrp.c | 15 +++++++--------
4 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index e0baa65f36c..54bd5525d2b 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -870,24 +870,26 @@ make_pass_dominator (gcc::context *ctxt)
class dom_jump_threader_simplifier : public jump_threader_simplifier
{
public:
- dom_jump_threader_simplifier (vr_values *v) : jump_threader_simplifier (v) {}
+ dom_jump_threader_simplifier (vr_values *v,
+ avail_exprs_stack *avails)
+ : jump_threader_simplifier (v, avails) {}
private:
- tree simplify (gimple *, gimple *, avail_exprs_stack *, basic_block);
+ tree simplify (gimple *, gimple *, basic_block);
};
tree
-dom_jump_threader_simplifier::simplify (gimple *stmt, gimple *within_stmt,
- avail_exprs_stack *avail_exprs_stack,
+dom_jump_threader_simplifier::simplify (gimple *stmt,
+ gimple *within_stmt,
basic_block bb)
{
/* First see if the conditional is in the hash table. */
- tree cached_lhs = avail_exprs_stack->lookup_avail_expr (stmt, false, true);
+ tree cached_lhs = m_avail_exprs_stack->lookup_avail_expr (stmt,
+ false, true);
if (cached_lhs)
return cached_lhs;
- return jump_threader_simplifier::simplify (stmt, within_stmt,
- avail_exprs_stack, bb);
+ return jump_threader_simplifier::simplify (stmt, within_stmt, bb);
}
/* Valueize hook for gimple_fold_stmt_to_constant_1. */
@@ -1461,7 +1463,8 @@ dom_opt_dom_walker::before_dom_children (basic_block bb)
void
dom_opt_dom_walker::after_dom_children (basic_block bb)
{
- dom_jump_threader_simplifier jthread_simplifier (&evrp_range_analyzer);
+ dom_jump_threader_simplifier jthread_simplifier (&evrp_range_analyzer,
+ m_avail_exprs_stack);
m_threader->thread_outgoing_edges (bb,
&evrp_range_analyzer,
jthread_simplifier);
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 576f6217987..a2890b984d0 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -388,8 +388,7 @@ jump_threader::record_temporary_equivalences_from_stmts_at_dest (edge e,
SET_USE (use_p, tmp);
}
- cached_lhs = simplifier.simplify (stmt, stmt,
- m_avail_exprs_stack, e->src);
+ cached_lhs = simplifier.simplify (stmt, stmt, e->src);
/* Restore the statement's original uses/defs. */
i = 0;
@@ -538,13 +537,11 @@ jump_threader::simplify_control_stmt_condition
the label that is proven to be taken. */
gswitch *dummy_switch = as_a<gswitch *> (gimple_copy (stmt));
gimple_switch_set_index (dummy_switch, cached_lhs);
- cached_lhs = simplifier.simplify (dummy_switch, stmt,
- m_avail_exprs_stack, e->src);
+ cached_lhs = simplifier.simplify (dummy_switch, stmt, e->src);
ggc_free (dummy_switch);
}
else
- cached_lhs = simplifier.simplify (stmt, stmt, m_avail_exprs_stack,
- e->src);
+ cached_lhs = simplifier.simplify (stmt, stmt, e->src);
}
/* We couldn't find an invariant. But, callers of this
@@ -722,7 +719,7 @@ jump_threader::simplify_control_stmt_condition_1
then use the pass specific callback to simplify the condition. */
if (!res
|| !is_gimple_min_invariant (res))
- res = simplifier.simplify (dummy_cond, stmt, m_avail_exprs_stack, e->src);
+ res = simplifier.simplify (dummy_cond, stmt, e->src);
return res;
}
@@ -1393,7 +1390,6 @@ jump_threader::thread_outgoing_edges (basic_block bb,
tree
jump_threader_simplifier::simplify (gimple *stmt,
gimple *within_stmt,
- avail_exprs_stack *,
basic_block)
{
if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))
diff --git a/gcc/tree-ssa-threadedge.h b/gcc/tree-ssa-threadedge.h
index 4b23f7030f8..da628a4f51d 100644
--- a/gcc/tree-ssa-threadedge.h
+++ b/gcc/tree-ssa-threadedge.h
@@ -80,10 +80,16 @@ private:
class jump_threader_simplifier
{
public:
- jump_threader_simplifier (vr_values *v) : m_vr_values (v) { }
- virtual tree simplify (gimple *, gimple *, avail_exprs_stack *, basic_block);
+ jump_threader_simplifier (vr_values *v,
+ avail_exprs_stack *avails)
+ : m_vr_values (v),
+ m_avail_exprs_stack (avails)
+ { }
+ virtual tree simplify (gimple *, gimple *, basic_block);
+
protected:
vr_values *m_vr_values;
+ avail_exprs_stack *m_avail_exprs_stack;
};
extern vec<tree> ssa_name_values;
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 33a48fbfe6f..3798b27a86a 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4280,21 +4280,20 @@ vrp_jump_threader::before_dom_children (basic_block bb)
class vrp_jump_threader_simplifier : public jump_threader_simplifier
{
public:
- vrp_jump_threader_simplifier (vr_values *v) : jump_threader_simplifier (v) {}
+ vrp_jump_threader_simplifier (vr_values *v, avail_exprs_stack *avails)
+ : jump_threader_simplifier (v, avails) {}
private:
- tree simplify (gimple *, gimple *, avail_exprs_stack *,
- basic_block) OVERRIDE;
+ tree simplify (gimple *, gimple *, basic_block) OVERRIDE;
};
tree
vrp_jump_threader_simplifier::simplify (gimple *stmt,
gimple *within_stmt,
- avail_exprs_stack *avail_exprs_stack,
basic_block bb)
{
/* First see if the conditional is in the hash table. */
- tree cached_lhs = avail_exprs_stack->lookup_avail_expr (stmt, false, true);
+ tree cached_lhs = m_avail_exprs_stack->lookup_avail_expr (stmt, false, true);
if (cached_lhs && is_gimple_min_invariant (cached_lhs))
return cached_lhs;
@@ -4323,8 +4322,7 @@ vrp_jump_threader_simplifier::simplify (gimple *stmt,
return find_case_label_range (switch_stmt, vr);
}
- return jump_threader_simplifier::simplify (stmt, within_stmt,
- avail_exprs_stack, bb);
+ return jump_threader_simplifier::simplify (stmt, within_stmt, bb);
}
/* Called after processing dominator children of BB. This is where we
@@ -4332,7 +4330,8 @@ vrp_jump_threader_simplifier::simplify (gimple *stmt,
void
vrp_jump_threader::after_dom_children (basic_block bb)
{
- vrp_jump_threader_simplifier jthread_simplifier (m_vr_values);
+ vrp_jump_threader_simplifier jthread_simplifier (m_vr_values,
+ m_avail_exprs_stack);
m_threader->thread_outgoing_edges (bb, NULL, jthread_simplifier);
m_avail_exprs_stack->pop_to_marker ();
More information about the Gcc-cvs
mailing list