On Fri, Oct 27, 2017 at 03:19:05PM +0200, Martin Jambor wrote:
> 2017-10-10  Martin Jambor  <mjam...@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

Reply via email to