diff mbox

[03/13] Mark and skip distributed loops

Message ID VI1PR0802MB21767C65CF638F9E628ADAD5E7CD0@VI1PR0802MB2176.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Bin Cheng June 12, 2017, 5:02 p.m. UTC
Hi,
This simple patch marks distributed loops and skips it in following distribution.

Bootstrap and test on x86_64 and AArch64.  Is it OK?

Thanks,
bin
2017-06-07  Bin Cheng  <bin.cheng@arm.com>

	* tree-loop-distribution.c (generate_loops_for_partition): Mark
	distributed loops.
	(pass_loop_distribution::execute): Skip distributed loops.
From 705ad383bb8a806eb8b0fcd6faa298938dd3176b Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Wed, 7 Jun 2017 13:20:08 +0100
Subject: [PATCH 03/14] record-and-skip-distributed-loop-20170607.txt

---
 gcc/tree-loop-distribution.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Richard Biener June 13, 2017, 10:47 a.m. UTC | #1
On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> This simple patch marks distributed loops and skips it in following distribution.
>
> Bootstrap and test on x86_64 and AArch64.  Is it OK?

This is not necessary, FOR_EACH_LOOP first builds a vector of loops to
iterate over
so it will never pick up loops added during iteration.

Richard.

> Thanks,
> bin
> 2017-06-07  Bin Cheng  <bin.cheng@arm.com>
>
>         * tree-loop-distribution.c (generate_loops_for_partition): Mark
>         distributed loops.
>         (pass_loop_distribution::execute): Skip distributed loops.
Bin.Cheng June 13, 2017, 10:58 a.m. UTC | #2
On Tue, Jun 13, 2017 at 11:47 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>> Hi,
>> This simple patch marks distributed loops and skips it in following distribution.
>>
>> Bootstrap and test on x86_64 and AArch64.  Is it OK?
>
> This is not necessary, FOR_EACH_LOOP first builds a vector of loops to
> iterate over
> so it will never pick up loops added during iteration.
This was originally for loop nest distribution, but I didn't include
that part in this series.  I will withdraw it for now.

Thanks,
bin
>
> Richard.
>
>> Thanks,
>> bin
>> 2017-06-07  Bin Cheng  <bin.cheng@arm.com>
>>
>>         * tree-loop-distribution.c (generate_loops_for_partition): Mark
>>         distributed loops.
>>         (pass_loop_distribution::execute): Skip distributed loops.
diff mbox

Patch

diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 9f0c801..b0b9d66 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -618,8 +618,11 @@  generate_loops_for_partition (struct loop *loop, partition *partition,
 
   if (copy_p)
     {
+      int ldist_alias_id = loop->num;
       loop = copy_loop_before (loop);
       gcc_assert (loop != NULL);
+      loop->ldist_alias_id = ldist_alias_id;
+      loop->aux = (void *)loop;
       create_preheader (loop, CP_SIMPLE_PREHEADERS);
       create_bb_after_loop (loop);
     }
@@ -1770,6 +1773,9 @@  pass_loop_distribution::execute (function *fun)
 	gimple_set_uid (gsi_stmt (gsi), -1);
     }
 
+  FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
+    loop->aux = NULL;
+
   /* We can at the moment only distribute non-nested loops, thus restrict
      walking to innermost loops.  */
   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
@@ -1779,6 +1785,10 @@  pass_loop_distribution::execute (function *fun)
       int num = loop->num;
       unsigned int i;
 
+      /* Skip distributed loops.  */
+      if (loop->aux != NULL)
+	continue;
+
       /* If the loop doesn't have a single exit we will fail anyway,
 	 so do that early.  */
       if (!single_exit (loop))
@@ -1865,6 +1875,9 @@  out:
 	fprintf (dump_file, "Loop %d is the same.\n", num);
     }
 
+  FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
+    loop->aux = NULL;
+
   if (cd)
     delete cd;