Commit bcc6842b by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/81768 (error: control flow in the middle of basic block)

	PR middle-end/81768
	* omp-expand.c (expand_omp_simd): Force second operands of COND_EXPR
	into gimple val before gimplification fo the COND_EXPR.

	* gcc.dg/gomp/pr81768-1.c: New test.

From-SVN: r251741
parent 3d178f0c
2017-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/81768
* omp-expand.c (expand_omp_simd): Force second operands of COND_EXPR
into gimple val before gimplification fo the COND_EXPR.
2017-09-05 Aldy Hernandez <aldyh@redhat.com> 2017-09-05 Aldy Hernandez <aldyh@redhat.com>
* tree-ssa-threadupdate.c (duplicate_thread_path): Remove unused * tree-ssa-threadupdate.c (duplicate_thread_path): Remove unused
......
...@@ -4730,24 +4730,28 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) ...@@ -4730,24 +4730,28 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
tree itype2 = TREE_TYPE (fd->loops[i - 1].v); tree itype2 = TREE_TYPE (fd->loops[i - 1].v);
if (POINTER_TYPE_P (itype2)) if (POINTER_TYPE_P (itype2))
itype2 = signed_type_for (itype2); itype2 = signed_type_for (itype2);
t = fold_convert (itype2, fd->loops[i - 1].step);
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,
GSI_SAME_STMT);
t = build3 (COND_EXPR, itype2, t = build3 (COND_EXPR, itype2,
build2 (fd->loops[i].cond_code, boolean_type_node, build2 (fd->loops[i].cond_code, boolean_type_node,
fd->loops[i].v, fd->loops[i].v,
fold_convert (itype, fd->loops[i].n2)), fold_convert (itype, fd->loops[i].n2)),
build_int_cst (itype2, 0), build_int_cst (itype2, 0), t);
fold_convert (itype2, fd->loops[i - 1].step));
if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i - 1].v))) if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i - 1].v)))
t = fold_build_pointer_plus (fd->loops[i - 1].v, t); t = fold_build_pointer_plus (fd->loops[i - 1].v, t);
else else
t = fold_build2 (PLUS_EXPR, itype2, fd->loops[i - 1].v, t); t = fold_build2 (PLUS_EXPR, itype2, fd->loops[i - 1].v, t);
expand_omp_build_assign (&gsi, fd->loops[i - 1].v, t); expand_omp_build_assign (&gsi, fd->loops[i - 1].v, t);
t = fold_convert (itype, fd->loops[i].n1);
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,
GSI_SAME_STMT);
t = build3 (COND_EXPR, itype, t = build3 (COND_EXPR, itype,
build2 (fd->loops[i].cond_code, boolean_type_node, build2 (fd->loops[i].cond_code, boolean_type_node,
fd->loops[i].v, fd->loops[i].v,
fold_convert (itype, fd->loops[i].n2)), fold_convert (itype, fd->loops[i].n2)),
fd->loops[i].v, fd->loops[i].v, t);
fold_convert (itype, fd->loops[i].n1));
expand_omp_build_assign (&gsi, fd->loops[i].v, t); expand_omp_build_assign (&gsi, fd->loops[i].v, t);
} }
} }
......
2017-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/81768
* gcc.dg/gomp/pr81768-1.c: New test.
2017-09-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> 2017-09-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/81833 PR target/81833
......
/* PR middle-end/81768 */
/* { dg-do compile } */
float b[10][15][10];
void
foo (void)
{
float *i;
#pragma omp target parallel for simd schedule(static, 32) collapse(3)
for (i = &b[0][0][0]; i < &b[0][0][10]; i++)
for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)
for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)
b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] -= 3.5;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment