diff options
author | Dmitry Bocharnikov <dmitry.b@samsung.com> | 2013-10-08 08:07:22 +0000 |
---|---|---|
committer | Dmitry Bocharnikov <dmitry.b@samsung.com> | 2013-10-08 08:07:22 +0000 |
commit | 3ed6ca91bb85a0dcf0d255d4944bc74872fbe716 (patch) | |
tree | 72947573d5ccf01919cedc4ffa79e4a0483c72ee | |
parent | d5def24f92a5c5f0adb29c119520b615ad5a7cb5 (diff) |
Add check for irreducible loops
* gcc/oacc-low.c: loop_irreducible_p added.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/openacc-1_0-branch@203268 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog.ACC | 5 | ||||
-rw-r--r-- | gcc/oacc-low.c | 46 |
2 files changed, 44 insertions, 7 deletions
diff --git a/ChangeLog.ACC b/ChangeLog.ACC index 70613b58b06..9599e50f7ba 100644 --- a/ChangeLog.ACC +++ b/ChangeLog.ACC @@ -1,4 +1,9 @@ 08-10-2013 Dmitry Bocharnikov <dmitry.b@samsung.com> + Add check for irreducible loops + + * gcc/oacc-low.c: loop_irreducible_p added. + +08-10-2013 Dmitry Bocharnikov <dmitry.b@samsung.com> Add check for nesting restrictions * gcc/oacc-low.c: check_oacc_nesting_restrictions implemenation. diff --git a/gcc/oacc-low.c b/gcc/oacc-low.c index 2b997c388f3..122baa2eb5c 100644 --- a/gcc/oacc-low.c +++ b/gcc/oacc-low.c @@ -853,15 +853,47 @@ gen_add(gimple_stmt_iterator* gsi, gimple stmt) } static bool +loop_irreducible_p(struct loop* l) +{ + unsigned i; + basic_block *bbs; + bool res = false; + + if(loop_preheader_edge (l)->src->flags & BB_IRREDUCIBLE_LOOP) + { + return true; + } + + bbs = get_loop_body_in_dom_order (l); + for (i = 0; i < l->num_nodes; i++) + { + if (bbs[i]->flags & BB_IRREDUCIBLE_LOOP) + { + res = true; + break; + } + } + free (bbs); + + return res; +} + +static bool loop_precheck(struct loop* l) { - if(!single_dom_exit(l)) { - if(dump_file) { - fprintf(dump_file, " !single_dom_exit\n"); - } - return false; - } - return true; + if(!single_dom_exit(l)) + { + if(dump_file) + { + fprintf(dump_file, " !single_dom_exit\n"); + } + return false; + } + else if(!can_duplicate_loop_p(l) || loop_irreducible_p(l)) + { + return false; + } + return true; } static bool |