On 12/10/15 16:49, Tom de Vries wrote:
Hi,
I've committed the following patch series to the gomp-4_0-branch.
1 Add pass_dominator::jump_threading_p ()
2 Add dom_walker::walk_until
3 Add pass_dominator::sese_mode_p ()
4 Add skip_stmt parm to pass_dominator::get_sese ()
5 Add oacc kernels related infra functions
6 Add pass_dominator_oacc_kernels
The patch series adds a pass pass_dominator_oacc_kernels, which does the
pass_dominator optimizations (with the exception of jump threading) on
each oacc kernels region rather than on the whole function.
Bootstrapped and reg-tested on x86_64.
I'll post the patches individually, in reply to this email.
This patch adds the ability in pass_dominator to skip a stmt while
optimizing a sese region.
Thanks,
- Tom
Add skip_stmt parm to pass_dominator::get_sese ()
2015-10-12 Tom de Vries <t...@codesourcery.com>
* tree-ssa-dom.c (dom_opt_dom_walker::set_skip_stmt): New function.
(dom_opt_dom_walker::m_skip_stmt): New private var.
(pass_dominator::get_sese): Add skip_stmt parameters.
(pass_dominator::execute): Call set_skip_stmt with statement to skip for
sese.
(dom_opt_dom_walker::before_dom_children): Handle m_skip_stmt.
---
gcc/tree-ssa-dom.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 7a1250e..573e6fc 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -504,6 +504,7 @@ public:
virtual void before_dom_children (basic_block);
virtual void after_dom_children (basic_block);
+ void set_skip_stmt (gimple *skip_stmt) { m_skip_stmt = skip_stmt; }
private:
void thread_across_edge (edge);
@@ -514,6 +515,7 @@ private:
gcond *m_dummy_cond;
bool m_jump_threading_p;
+ gimple *m_skip_stmt;
};
/* Jump threading, redundancy elimination and const/copy propagation.
@@ -558,9 +560,11 @@ public:
virtual bool sese_mode_p (void) { return false; }
/* In sese mode, return true if there's another sese to visit. Return the
- sese to visit in SESE_ENTRY and SESE_EXIT. */
+ sese to visit in SESE_ENTRY and SESE_EXIT. If a stmt in the sese should
+ not be optimized, return it in SKIP_STMT. */
virtual bool get_sese (basic_block *sese_entry ATTRIBUTE_UNUSED,
- basic_block *sese_exit ATTRIBUTE_UNUSED)
+ basic_block *sese_exit ATTRIBUTE_UNUSED,
+ gimple **skip_stmt ATTRIBUTE_UNUSED)
{ gcc_unreachable (); }
}; // class pass_dominator
@@ -628,8 +632,11 @@ pass_dominator::execute (function *fun)
else
{
basic_block sese_entry, sese_exit;
- while (get_sese (&sese_entry, &sese_exit))
+ gimple *skip_stmt = NULL;
+ while (get_sese (&sese_entry, &sese_exit, &skip_stmt))
{
+ walker.set_skip_stmt (skip_stmt);
+
threadedge_initialize_values ();
avail_exprs_stack->push_marker ();
const_and_copies->push_marker ();
@@ -1363,7 +1370,12 @@ dom_opt_dom_walker::before_dom_children (basic_block bb)
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, m_avail_exprs_stack);
+ {
+ if (gsi_stmt (gsi) == m_skip_stmt)
+ continue;
+
+ optimize_stmt (bb, gsi, m_const_and_copies, m_avail_exprs_stack);
+ }
/* Now prepare to process dominated blocks. */
if (m_jump_threading_p)
--
1.9.1