This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [hsa] Add missing guard in OMP gridification
- From: Jakub Jelinek <jakub at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Pekka Jääskeläinen <pekka at parmance dot com>
- Date: Fri, 27 Oct 2017 15:37:09 +0200
- Subject: Re: [hsa] Add missing guard in OMP gridification
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E7718C04AC54
- References: <20171027131905.u26ekfkidb56t4ny@virgil.suse.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Oct 27, 2017 at 03:19:05PM +0200, Martin Jambor wrote:
> 2017-10-10 Martin Jambor <mjambor@suse.cz>
>
> * omp-grid.c (grid_attempt_target_gridification): Also insert a
> condition whether loop should be executed at all.
Ok, thanks.
> --- a/gcc/omp-grid.c
> +++ b/gcc/omp-grid.c
> @@ -1315,6 +1315,7 @@ grid_attempt_target_gridification (gomp_target *target,
> n1 = fold_convert (itype, n1);
> n2 = fold_convert (itype, n2);
>
> + tree cond = fold_build2 (cond_code, boolean_type_node, n1, n2);
> tree step
> = omp_get_for_step_from_incr (loc, gimple_omp_for_incr (inner_loop, i));
>
> @@ -1328,6 +1329,7 @@ grid_attempt_target_gridification (gomp_target *target,
> fold_build1 (NEGATE_EXPR, itype, step));
> else
> t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step);
> + t = fold_build3 (COND_EXPR, itype, cond, t, build_zero_cst (itype));
> if (grid.tiling)
> {
> if (cond_code == GT_EXPR)
> --
> 2.14.2
Jakub