From 2043cb2b63b4acc3f4fb1cf1d845ca885ada5a29 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 5 Apr 2012 10:31:04 +0200 Subject: [PATCH] isl_access_info_compute_flow: sort accesses in textual order Before, we tried to be clever and sorted the accesses in order of increasing number of shared levels with the sink access. However, this has little advantage over textual order. Textually later accesses that cannot precede the sink at a given level are simply skipped. On the other hand, when we consider a loop level, we usually do want to consider the textually last access first and not some textually earlier access that happens to share more levels with the sink. In particular, if this textually last access covers all the pending sink accesses, there is no need to consider earlier accesses, whereas you would always have to consider later accesses if you started out with an earlier access. Signed-off-by: Sven Verdoolaege --- isl_flow.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/isl_flow.c b/isl_flow.c index cc2cca6e..bbaee6ee 100644 --- a/isl_flow.c +++ b/isl_flow.c @@ -169,11 +169,7 @@ error: * the source access identified by p1 should be sorted before, together * or after that identified by p2. * - * If p1 and p2 share a different number of levels with the sink, - * then the one with the lowest number of shared levels should be - * sorted first. - * If they both share no levels, then the order is irrelevant. - * Otherwise, if p1 appears before p2, then it should be sorted first. + * If p1 appears before p2, then it should be sorted first. * For more generic initial schedules, it is possible that neither * p1 nor p2 appears before the other, or at least not in any obvious way. * We therefore also check if p2 appears before p1, in which case p2 @@ -191,12 +187,6 @@ static int access_sort_cmp(const void *p1, const void *p2, void *user) i1 = (const struct isl_labeled_map *) p1; i2 = (const struct isl_labeled_map *) p2; - level1 = acc->level_before(i1->data, acc->sink.data); - level2 = acc->level_before(i2->data, acc->sink.data); - - if (level1 != level2 || !level1) - return level1 - level2; - level1 = acc->level_before(i1->data, i2->data); if (level1 % 2) return -1; @@ -210,10 +200,7 @@ static int access_sort_cmp(const void *p1, const void *p2, void *user) return h1 > h2 ? 1 : h1 < h2 ? -1 : 0; } -/* Sort the must source accesses in order of increasing number of shared - * levels with the sink access. - * Source accesses with the same number of shared levels are sorted - * in their textual order. +/* Sort the must source accesses in their textual order. */ static __isl_give isl_access_info *isl_access_info_sort_sources( __isl_take isl_access_info *acc) -- 2.11.4.GIT