bool add_safelen1;
bool order_concurrent;
bool has_depend;
+ bool in_for_exprs;
int defaultmap[4];
};
if (gimplify_omp_ctxp)
{
struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
- int flag = GOVD_LOCAL;
+ int flag = GOVD_LOCAL | GOVD_SEEN;
while (ctx
&& (ctx->region_type == ORT_WORKSHARE
|| ctx->region_type == ORT_TASKGROUP
{
if (TREE_CODE (DECL_SIZE_UNIT (tmp)) != INTEGER_CST)
ctx->add_safelen1 = true;
- else
+ else if (ctx->in_for_exprs)
flag = GOVD_PRIVATE;
+ else
+ flag = GOVD_PRIVATE | GOVD_SEEN;
break;
}
ctx = ctx->outer_context;
}
if (ctx)
- omp_add_variable (ctx, tmp, flag | GOVD_SEEN);
+ omp_add_variable (ctx, tmp, flag);
}
}
else if (cfun)
goto do_outer;
}
+ /* Don't mark as GOVD_SEEN addressable temporaries seen only in simd
+ lb, b or incr expressions, those shouldn't be turned into simd arrays. */
+ if (ctx->region_type == ORT_SIMD
+ && ctx->in_for_exprs
+ && ((n->value & (GOVD_PRIVATE | GOVD_SEEN | GOVD_EXPLICIT))
+ == GOVD_PRIVATE))
+ flags &= ~GOVD_SEEN;
+
if ((n->value & (GOVD_SEEN | GOVD_LOCAL)) == 0
&& (flags & (GOVD_SEEN | GOVD_LOCAL)) == GOVD_SEEN
&& DECL_SIZE (decl))
else
var = decl;
+ gimplify_omp_ctxp->in_for_exprs = true;
if (TREE_CODE (TREE_OPERAND (t, 1)) == TREE_VEC)
{
tree lb = TREE_OPERAND (t, 1);
else
tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
is_gimple_val, fb_rvalue, false);
+ gimplify_omp_ctxp->in_for_exprs = false;
ret = MIN (ret, tret);
if (ret == GS_ERROR)
return ret;
gcc_assert (COMPARISON_CLASS_P (t));
gcc_assert (TREE_OPERAND (t, 0) == decl);
+ gimplify_omp_ctxp->in_for_exprs = true;
if (TREE_CODE (TREE_OPERAND (t, 1)) == TREE_VEC)
{
tree ub = TREE_OPERAND (t, 1);
else
tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
is_gimple_val, fb_rvalue, false);
+ gimplify_omp_ctxp->in_for_exprs = false;
ret = MIN (ret, tret);
/* Handle OMP_FOR_INCR. */
gcc_unreachable ();
}
+ gimplify_omp_ctxp->in_for_exprs = true;
tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
is_gimple_val, fb_rvalue, false);
ret = MIN (ret, tret);
ret = MIN (ret, tret);
}
}
+ gimplify_omp_ctxp->in_for_exprs = false;
break;
default: