>       case NE_EXPR:
> -       if (!flag_enable_cilk)
> +       /* NE_EXPR is only allowed for Cilk Plus loops.  */
> +       if (flag_enable_cilk
> +           && gimple_omp_for_kind (for_stmt) == GF_OMP_FOR_KIND_CILKSIMD)
> +         break;
> +       else
>           gcc_unreachable ();
> -       /* NE_EXPR is technically not allowed in OpenMP, but it is
> -          allowed in Cilk Plus, which generates OMP_SIMD constructs.  */
> -       break;

Something I'm going to bring up wrt the main cilk+ patches, but checking
flag_enable_cilk is useless.  One can only get KIND_CILKSIMD if cilk is
enabled, and the test itself is very inexpensive.

Better as

  if (gimple_omp_for_kind (for_stmt) == GF_OMP_FOR_KIND_CILKSIMD)
    {
      // if you really thing we need to check it...
      gcc_checking_assert (flag_enable_cilk);
      break;
    }
  gcc_unreachable ();

Or, best as

  gcc_checking_assert (flag_enable_cilk);
  gcc_assert (gimple_omp_for_kind (for_stmt) == GF_OMP_FOR_KIND_CILKSIMD);
  break;

since I believe the front end should have already checked this grammar.

> +  bool cilkplus_block = false;
> +  if (flag_enable_cilk)
> +    {
> +      if ((branch_ctx
> +        && gimple_code (branch_ctx) == GIMPLE_OMP_FOR
> +        && gimple_omp_for_kind (branch_ctx) & GF_OMP_FOR_KIND_CILKSIMD)
> +       || (gimple_code (label_ctx) == GIMPLE_OMP_FOR
> +           && gimple_omp_for_kind (label_ctx) & GF_OMP_FOR_KIND_CILKSIMD))
> +     cilkplus_block = true;
> +    }

The & tests here aren't right.  Recall that CILKSIMD == 3 << 3, so that covers
DISTRIBUTE and normal SIMD as well.  The only & tests should have been for SIMD
when one wants both SIMD and CILKSIMD.


r~

Reply via email to