diff options
Diffstat (limited to 'gcc/omp-expand.c')
-rw-r--r-- | gcc/omp-expand.c | 89 |
1 files changed, 53 insertions, 36 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 0c31f95..2eae8c0 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -3257,6 +3257,25 @@ expand_omp_for_generic (struct omp_region *region, vmain = gimple_omp_continue_control_use (cont_stmt); vback = gimple_omp_continue_control_def (cont_stmt); + if (cond_var) + { + tree itype = TREE_TYPE (cond_var); + tree t2; + if ((fd->ordered && fd->collapse == 1) + || bias + || POINTER_TYPE_P (type) + || TREE_CODE (fd->loop.n1) != INTEGER_CST + || fd->loop.cond_code != LT_EXPR) + t2 = build_int_cst (itype, 1); + else + t2 = fold_convert (itype, fd->loop.step); + t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2); + t2 = force_gimple_operand_gsi (&gsi, t2, false, + NULL_TREE, true, GSI_SAME_STMT); + assign_stmt = gimple_build_assign (cond_var, t2); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); + } + if (!gimple_omp_for_combined_p (fd->for_stmt)) { if (POINTER_TYPE_P (type)) @@ -3270,25 +3289,6 @@ expand_omp_for_generic (struct omp_region *region, assign_stmt = gimple_build_assign (vback, t); gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); - if (cond_var) - { - tree itype = TREE_TYPE (cond_var); - tree t2; - if ((fd->ordered && fd->collapse == 1) - || bias - || POINTER_TYPE_P (type) - || TREE_CODE (fd->loop.n1) != INTEGER_CST - || fd->loop.cond_code != LT_EXPR) - t2 = build_int_cst (itype, 1); - else - t2 = fold_convert (itype, fd->loop.step); - t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2); - t2 = force_gimple_operand_gsi (&gsi, t2, false, - NULL_TREE, true, GSI_SAME_STMT); - assign_stmt = gimple_build_assign (cond_var, t2); - gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); - } - if (fd->ordered && counts[fd->collapse - 1] == NULL_TREE) { tree tem; @@ -3962,6 +3962,23 @@ expand_omp_for_static_nochunk (struct omp_region *region, vmain = gimple_omp_continue_control_use (cont_stmt); vback = gimple_omp_continue_control_def (cont_stmt); + if (cond_var) + { + tree itype = TREE_TYPE (cond_var); + tree t2; + if (POINTER_TYPE_P (type) + || TREE_CODE (n1) != INTEGER_CST + || fd->loop.cond_code != LT_EXPR) + t2 = build_int_cst (itype, 1); + else + t2 = fold_convert (itype, step); + t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2); + t2 = force_gimple_operand_gsi (&gsi, t2, false, + NULL_TREE, true, GSI_SAME_STMT); + assign_stmt = gimple_build_assign (cond_var, t2); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); + } + if (!gimple_omp_for_combined_p (fd->for_stmt)) { if (POINTER_TYPE_P (type)) @@ -3975,23 +3992,6 @@ expand_omp_for_static_nochunk (struct omp_region *region, assign_stmt = gimple_build_assign (vback, t); gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); - if (cond_var) - { - tree itype = TREE_TYPE (cond_var); - tree t2; - if (POINTER_TYPE_P (type) - || TREE_CODE (n1) != INTEGER_CST - || fd->loop.cond_code != LT_EXPR) - t2 = build_int_cst (itype, 1); - else - t2 = fold_convert (itype, step); - t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2); - t2 = force_gimple_operand_gsi (&gsi, t2, false, - NULL_TREE, true, GSI_SAME_STMT); - assign_stmt = gimple_build_assign (cond_var, t2); - gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); - } - t = build2 (fd->loop.cond_code, boolean_type_node, DECL_P (vback) && TREE_ADDRESSABLE (vback) ? t : vback, e); @@ -4607,6 +4607,23 @@ expand_omp_for_static_chunk (struct omp_region *region, vmain = gimple_omp_continue_control_use (cont_stmt); vback = gimple_omp_continue_control_def (cont_stmt); + if (cond_var) + { + tree itype = TREE_TYPE (cond_var); + tree t2; + if (POINTER_TYPE_P (type) + || TREE_CODE (n1) != INTEGER_CST + || fd->loop.cond_code != LT_EXPR) + t2 = build_int_cst (itype, 1); + else + t2 = fold_convert (itype, step); + t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2); + t2 = force_gimple_operand_gsi (&gsi, t2, false, + NULL_TREE, true, GSI_SAME_STMT); + assign_stmt = gimple_build_assign (cond_var, t2); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); + } + if (!gimple_omp_for_combined_p (fd->for_stmt)) { if (POINTER_TYPE_P (type)) |