diff mbox

Merge trunk r225562 (2015-07-08) into gomp-4_0-branch

Message ID 55A4DAA5.9090202@mentor.com
State New
Headers show

Commit Message

Tom de Vries July 14, 2015, 9:47 a.m. UTC
On 13/07/15 10:31, Thomas Schwinge wrote:
> Hi Tom!
>
> On Mon, 13 Jul 2015 09:20:16 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> On 12/07/15 11:39, Thomas Schwinge wrote:
>>> On Fri, 10 Jul 2015 18:50:20 -0400, Nathan Sidwell <nathan_sidwell@mentor.com> wrote:
>>>> it looks like the most recent merge from trunk to gomp4 was early May.  I think
>>>> it is time for another one -- can you handle that?
>>>
>>> Indeed :-) -- and, as it happens, resolving the "merge artifacts" is one
>>> of the things I've been working on last week.  I hope I got that all
>>> right, in particular gcc/tree-parloops.c (Tom),
>>
>> I've looked at the merge commit, gcc/tree-parloops.c was not modified.
>
> (Well, it was, but not "substantially".)  You'd ported all your trunk
> commits to gomp-4_0-branch already (thanks!), and in the functions where
> I got merge conflicts, I just retained the code that was present on
> gomp-4_0-branch already, which apparently was the right thing to do.  ;-)
>
>
>>> gcc/tree-ssa-loop-ch.c (Tom),
>>
>> That looks ok. I just wonder whether we could have derived
>> pass_ch_oacc_kernels from pass_ch instead of from ch_base, avoiding
>> duplicating the execute function, and have
>> pass_ch_oacc_kernels::process_loop_p call pass_ch::process_loop_p rather
>> than inline it.
>
> Your call, depending on what makes the most sense regarding the semantics
> of pass_ch_oacc_kernels.
>

I've build attached patch, and ran goacc.exp, that all went ok. I'll do 
bootstrap and reg-test, and commit.

> I was just (pleasantly) surprised to find myself (capable of) doing a
> little C++ programming, with classes, inheritance, and so on.  ;-)
>

Heh. I know the feeling :)

Thanks,
- Tom
diff mbox

Patch

Derive pass_ch_oacc_kernels from pass_ch

2015-07-14  Tom de Vries  <tom@codesourcery.com>

	* tree-ssa-loop-ch.c (pass_ch::pass_ch (pass_data, gcc::context)): New
	constructor.
	(pass_ch_oacc_kernels): Derive from pass_ch.
	(pass_ch_oacc_kernels::pass_ch_oacc_kernels(gcc::context)): Call pass_ch
	constructor.
	(pass_ch_oacc_kernels::execute): Remove.
	(pass_ch_oacc_kernels::process_loop_p): Rewrite using
	pass_ch::process_loop_p.
---
 gcc/tree-ssa-loop-ch.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 4256ef0..c28e1e8 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -165,6 +165,10 @@  public:
     : ch_base (pass_data_ch, ctxt)
   {}
 
+  pass_ch (pass_data data, gcc::context *ctxt)
+    : ch_base (data, ctxt)
+  {}
+
   /* opt_pass methods: */
   virtual bool gate (function *) { return flag_tree_ch != 0; }
   
@@ -436,43 +440,30 @@  const pass_data pass_data_ch_oacc_kernels =
   TODO_cleanup_cfg, /* todo_flags_finish */
 };
 
-class pass_ch_oacc_kernels : public ch_base
+class pass_ch_oacc_kernels : public pass_ch
 {
 public:
   pass_ch_oacc_kernels (gcc::context *ctxt)
-    : ch_base (pass_data_ch_oacc_kernels, ctxt)
+    : pass_ch (pass_data_ch_oacc_kernels, ctxt)
   {}
 
   /* opt_pass methods: */
   virtual bool gate (function *) { return true; }
-  virtual unsigned int execute (function *);
 
 protected:
   /* ch_base method: */
   virtual bool process_loop_p (struct loop *loop);
 }; // class pass_ch_oacc_kernels
 
-unsigned int
-pass_ch_oacc_kernels::execute (function *fun)
-{
-  loop_optimizer_init (LOOPS_HAVE_PREHEADERS
-		       | LOOPS_HAVE_SIMPLE_LATCHES);
-
-  unsigned int res = copy_headers (fun);
-
-  loop_optimizer_finalize ();
-  return res;
-}
-
 } // anon namespace
 
 bool
 pass_ch_oacc_kernels::process_loop_p (struct loop *loop)
 {
-  if (do_while_loop_p (loop))
+  if (!loop->in_oacc_kernels_region)
     return false;
 
-  return loop->in_oacc_kernels_region;
+  return pass_ch::process_loop_p (loop);
 }
 
 gimple_opt_pass *
-- 
1.9.1