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.ch...@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 <binch...@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(+)
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;
--
1.9.1