* Re: [PATCH] Do not allow irreducible loops/regions in a scop
[not found] <1446790341-12347-1-git-send-email-aditya.k7@samsung.com>
@ 2015-11-06 13:50 ` Sebastian Pop
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Pop @ 2015-11-06 13:50 UTC (permalink / raw)
To: Aditya Kumar, GCC Patches, Tobias Grosser; +Cc: Sebastian Paul Pop
On Thu, Nov 5, 2015 at 10:12 PM, Aditya Kumar <aditya.k7@samsung.com> wrote:
> Irreducible regions are not going to be optimized by ISL
> so discard them early.
>
> gcc/ChangeLog:
>
> 2015-11-06 Aditya Kumar <aditya.k7@samsung.com>
>
> * graphite-scop-detection.c (scop_detection::merge_sese):
> (scop_detection::can_represent_loop_1):
> (scop_detection::harmful_stmt_in_region):
Ok.
I will add "Check flag *_IRREDUCIBLE_LOOP." to the changelog before committing.
Thanks for taking care of this.
Sebastian
>
>
> ---
> gcc/graphite-scop-detection.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
> index 8d67883..4e19b63 100644
> --- a/gcc/graphite-scop-detection.c
> +++ b/gcc/graphite-scop-detection.c
> @@ -605,7 +605,8 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
> get_entry_bb (second));
>
> edge entry = get_nearest_dom_with_single_entry (dom);
> - if (!entry)
> +
> + if (!entry || (entry->flags & EDGE_IRREDUCIBLE_LOOP))
> return invalid_sese;
>
> basic_block pdom = nearest_common_dominator (CDI_POST_DOMINATORS,
> @@ -614,7 +615,8 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
> pdom = nearest_common_dominator (CDI_POST_DOMINATORS, dom, pdom);
>
> edge exit = get_nearest_pdom_with_single_exit (pdom);
> - if (!exit)
> +
> + if (!exit || (exit->flags & EDGE_IRREDUCIBLE_LOOP))
> return invalid_sese;
>
> sese_l combined (entry, exit);
> @@ -734,6 +736,7 @@ scop_detection::can_represent_loop_1 (loop_p loop, sese_l scop)
> struct tree_niter_desc niter_desc;
>
> return single_exit (loop)
> + && (loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP)
> && number_of_iterations_exit (loop, single_exit (loop), &niter_desc, false)
> && niter_desc.control.no_overflow
> && (niter = number_of_latch_executions (loop))
> @@ -864,6 +867,10 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
> if (!dominated_by_p (CDI_POST_DOMINATORS, bb, exit_bb))
> continue;
>
> + /* The basic block should not be part of an irreducible loop. */
> + if (bb->flags & BB_IRREDUCIBLE_LOOP)
> + return true;
> +
> if (harmful_stmt_in_bb (scop, bb))
> return true;
> }
> --
> 2.1.0.243.g30d45f7
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] Do not allow irreducible loops/regions in a scop
@ 2015-11-06 17:43 Aditya Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Aditya Kumar @ 2015-11-06 17:43 UTC (permalink / raw)
To: gcc-patches
Cc: tobias, richard.guenther, aditya.k7, s.pop, sebpop, a.zaafrani
Irreducible regions are not going to be optimized by ISL
so discard them early. Passes bootstrap and regtest.
gcc/ChangeLog:
2015-11-06 Aditya Kumar <aditya.k7@samsung.com>
* graphite-scop-detection.c (scop_detection::merge_sese): Entry and exit edges should not be a part of irreducible loop.
(scop_detection::can_represent_loop_1): Loops should not be irreducible.
(scop_detection::harmful_stmt_in_region): All the basic block should belong to reducible loops.
---
gcc/graphite-scop-detection.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index ae8497d..b1f2ebc 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -794,7 +794,8 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
get_entry_bb (second));
edge entry = get_nearest_dom_with_single_entry (dom);
- if (!entry)
+
+ if (!entry || (entry->flags & EDGE_IRREDUCIBLE_LOOP))
return invalid_sese;
basic_block pdom = nearest_common_dominator (CDI_POST_DOMINATORS,
@@ -803,7 +804,8 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
pdom = nearest_common_dominator (CDI_POST_DOMINATORS, dom, pdom);
edge exit = get_nearest_pdom_with_single_exit (pdom);
- if (!exit)
+
+ if (!exit || (exit->flags & EDGE_IRREDUCIBLE_LOOP))
return invalid_sese;
sese_l combined (entry, exit);
@@ -923,6 +925,7 @@ scop_detection::can_represent_loop_1 (loop_p loop, sese_l scop)
struct tree_niter_desc niter_desc;
return single_exit (loop)
+ && !(loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP)
&& number_of_iterations_exit (loop, single_exit (loop), &niter_desc, false)
&& niter_desc.control.no_overflow
&& (niter = number_of_latch_executions (loop))
@@ -1053,6 +1056,10 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
if (!dominated_by_p (CDI_POST_DOMINATORS, bb, exit_bb))
continue;
+ /* The basic block should not be part of an irreducible loop. */
+ if (bb->flags & BB_IRREDUCIBLE_LOOP)
+ return true;
+
if (harmful_stmt_in_bb (scop, bb))
return true;
}
--
2.1.0.243.g30d45f7
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-06 17:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1446790341-12347-1-git-send-email-aditya.k7@samsung.com>
2015-11-06 13:50 ` [PATCH] Do not allow irreducible loops/regions in a scop Sebastian Pop
2015-11-06 17:43 Aditya Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).