From 0ff9e61b747b68d87dd5eb9cd091a10669ac73c3 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 16 Dec 2013 16:56:13 -0500 Subject: [PATCH] Introduce gimple_omp_continue This corresponds to: [PATCH 36/89] Introduce gimple_omp_continue https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01205.html from the original 89-patch kit That earlier patch was approved by Jeff: > OK with expected changes due to renaming/updates to const handling. > Please repost the final patch for archival purposes. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00826.html gcc/ * coretypes.h (gimple_omp_continue): New typedef. (const_gimple_omp_continue): New typedef. * gimple.h (gimple_build_omp_continue): Return a gimple_omp_continue rather than a plain gimple. (gimple_omp_continue_control_def): Require a const_gimple_omp_continue rather than a plain const_gimple. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gimple_omp_continue rather than a plain gimple. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. * gimple-pretty-print.c (dump_gimple_omp_continue): Require a gimple_omp_continue rather than a plain gimple. (pp_gimple_stmt_1): Add a checked cast to gimple_omp_continue within GIMPLE_OMP_CONTINUE case of switch statement. * gimple-walk.c (walk_gimple_op): Likewise, adding a new local. * gimple.c (gimple_build_omp_continue): Return a gimple_omp_continue rather than a plain gimple. * omp-low.c (gimple_build_cond_empty): Return a gimple_cond rather than a plain gimple. (expand_omp_for_generic): Split local "stmt" into "assign_stmt", "cont_stmt", "cond_stmt", "call_stmt" of types gimple_assign, gimple_omp_continue, gimple_cond, gimple_call respectively. (expand_omp_for_static_nochunk): Likewise, splitting into two "cond_stmt" decls. "assign_stmt", "cont_stmt" (expand_omp_for_static_chunk): Likewise, splitting into "cond_stmt", "assign_stmt", "cont_stmt". (expand_omp_sections): Strengthen local "cont" from gimple to gimple_omp_continue. --- gcc/ChangeLog.gimple-classes | 40 +++++++++++ gcc/coretypes.h | 4 ++ gcc/gimple-pretty-print.c | 6 +- gcc/gimple-walk.c | 19 ++--- gcc/gimple.c | 5 +- gcc/gimple.h | 38 ++++------ gcc/omp-low.c | 163 ++++++++++++++++++++++--------------------- 7 files changed, 158 insertions(+), 117 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 0073b059de4..5a87159b543 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,45 @@ 2014-10-24 David Malcolm + Introduce gimple_omp_continue + + * coretypes.h (gimple_omp_continue): New typedef. + (const_gimple_omp_continue): New typedef. + + * gimple.h (gimple_build_omp_continue): Return a + gimple_omp_continue rather than a plain gimple. + (gimple_omp_continue_control_def): Require a + const_gimple_omp_continue rather than a plain const_gimple. + (gimple_omp_continue_control_use): Likewise. + (gimple_omp_continue_control_def_ptr): Require a gimple_omp_continue + rather than a plain gimple. + (gimple_omp_continue_set_control_def): Likewise. + (gimple_omp_continue_control_use_ptr): Likewise. + (gimple_omp_continue_set_control_use): Likewise. + + * gimple-pretty-print.c (dump_gimple_omp_continue): Require a + gimple_omp_continue rather than a plain gimple. + (pp_gimple_stmt_1): Add a checked cast to gimple_omp_continue + within GIMPLE_OMP_CONTINUE case of switch statement. + + * gimple-walk.c (walk_gimple_op): Likewise, adding a new local. + + * gimple.c (gimple_build_omp_continue): Return a + gimple_omp_continue rather than a plain gimple. + + * omp-low.c (gimple_build_cond_empty): Return a gimple_cond + rather than a plain gimple. + (expand_omp_for_generic): Split local "stmt" into "assign_stmt", + "cont_stmt", "cond_stmt", "call_stmt" of types gimple_assign, + gimple_omp_continue, gimple_cond, gimple_call respectively. + (expand_omp_for_static_nochunk): Likewise, splitting into two + "cond_stmt" decls. "assign_stmt", "cont_stmt" + (expand_omp_for_static_chunk): Likewise, splitting into + "cond_stmt", "assign_stmt", "cont_stmt". + (expand_omp_sections): Strengthen local "cont" from gimple to + gimple_omp_continue. + +2014-10-24 David Malcolm + Introduce gimple_omp_atomic_store * coretypes.h (gimple_omp_atomic_store): New typedef. diff --git a/gcc/coretypes.h b/gcc/coretypes.h index 78647b21d3d..197bbf66783 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -176,6 +176,10 @@ typedef struct gimple_statement_omp_atomic_store *gimple_omp_atomic_store; typedef const struct gimple_statement_omp_atomic_store * const_gimple_omp_atomic_store; +struct gimple_statement_omp_continue; +typedef struct gimple_statement_omp_continue *gimple_omp_continue; +typedef const struct gimple_statement_omp_continue *const_gimple_omp_continue; + union section; typedef union section section; struct gcc_options; diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 62e4bf836d0..9af7f249289 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1253,7 +1253,8 @@ dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags) /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags) +dump_gimple_omp_continue (pretty_printer *buffer, gimple_omp_continue gs, + int spc, int flags) { if (flags & TDF_RAW) { @@ -2159,7 +2160,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) break; case GIMPLE_OMP_CONTINUE: - dump_gimple_omp_continue (buffer, gs, spc, flags); + dump_gimple_omp_continue (buffer, as_a (gs), spc, + flags); break; case GIMPLE_OMP_SINGLE: diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index 987b8560940..39ffc556549 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -298,15 +298,18 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, break; case GIMPLE_OMP_CONTINUE: - ret = walk_tree (gimple_omp_continue_control_def_ptr (stmt), - callback_op, wi, pset); - if (ret) - return ret; + { + gimple_omp_continue cont_stmt = as_a (stmt); + ret = walk_tree (gimple_omp_continue_control_def_ptr (cont_stmt), + callback_op, wi, pset); + if (ret) + return ret; - ret = walk_tree (gimple_omp_continue_control_use_ptr (stmt), - callback_op, wi, pset); - if (ret) - return ret; + ret = walk_tree (gimple_omp_continue_control_use_ptr (cont_stmt), + callback_op, wi, pset); + if (ret) + return ret; + } break; case GIMPLE_OMP_CRITICAL: diff --git a/gcc/gimple.c b/gcc/gimple.c index 1bc176cc9cc..115b84e864d 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -959,10 +959,11 @@ gimple_build_omp_taskgroup (gimple_seq body) CONTROL_DEF is the definition of the control variable. CONTROL_USE is the use of the control variable. */ -gimple +gimple_omp_continue gimple_build_omp_continue (tree control_def, tree control_use) { - gimple p = gimple_alloc (GIMPLE_OMP_CONTINUE, 0); + gimple_omp_continue p = + as_a (gimple_alloc (GIMPLE_OMP_CONTINUE, 0)); gimple_omp_continue_set_control_def (p, control_def); gimple_omp_continue_set_control_use (p, control_use); return p; diff --git a/gcc/gimple.h b/gcc/gimple.h index 4513fcbfe45..5377da31107 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1349,7 +1349,7 @@ gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree); gimple gimple_build_omp_section (gimple_seq); gimple gimple_build_omp_master (gimple_seq); gimple gimple_build_omp_taskgroup (gimple_seq); -gimple gimple_build_omp_continue (tree, tree); +gimple_omp_continue gimple_build_omp_continue (tree, tree); gimple gimple_build_omp_ordered (gimple_seq); gimple gimple_build_omp_return (bool); gimple gimple_build_omp_sections (gimple_seq, tree); @@ -5448,64 +5448,52 @@ gimple_omp_atomic_load_rhs_ptr (gimple_omp_atomic_load load_stmt) /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ static inline tree -gimple_omp_continue_control_def (const_gimple g) +gimple_omp_continue_control_def (const_gimple_omp_continue cont_stmt) { - const gimple_statement_omp_continue *omp_continue_stmt = - as_a (g); - return omp_continue_stmt->control_def; + return cont_stmt->control_def; } /* The same as above, but return the address. */ static inline tree * -gimple_omp_continue_control_def_ptr (gimple g) +gimple_omp_continue_control_def_ptr (gimple_omp_continue cont_stmt) { - gimple_statement_omp_continue *omp_continue_stmt = - as_a (g); - return &omp_continue_stmt->control_def; + return &cont_stmt->control_def; } /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ static inline void -gimple_omp_continue_set_control_def (gimple g, tree def) +gimple_omp_continue_set_control_def (gimple_omp_continue cont_stmt, tree def) { - gimple_statement_omp_continue *omp_continue_stmt = - as_a (g); - omp_continue_stmt->control_def = def; + cont_stmt->control_def = def; } /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */ static inline tree -gimple_omp_continue_control_use (const_gimple g) +gimple_omp_continue_control_use (const_gimple_omp_continue cont_stmt) { - const gimple_statement_omp_continue *omp_continue_stmt = - as_a (g); - return omp_continue_stmt->control_use; + return cont_stmt->control_use; } /* The same as above, but return the address. */ static inline tree * -gimple_omp_continue_control_use_ptr (gimple g) +gimple_omp_continue_control_use_ptr (gimple_omp_continue cont_stmt) { - gimple_statement_omp_continue *omp_continue_stmt = - as_a (g); - return &omp_continue_stmt->control_use; + return &cont_stmt->control_use; } /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */ static inline void -gimple_omp_continue_set_control_use (gimple g, tree use) +gimple_omp_continue_set_control_use (gimple_omp_continue cont_stmt, tree use) { - gimple_statement_omp_continue *omp_continue_stmt = - as_a (g); - omp_continue_stmt->control_use = use; + cont_stmt->control_use = use; } /* Return a pointer to the body for the GIMPLE_TRANSACTION statement diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 78ec43f63f3..6f3b9063850 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4340,7 +4340,7 @@ lower_send_shared_vars (gimple_seq *ilist, gimple_seq *olist, omp_context *ctx) /* A convenience function to build an empty GIMPLE_COND with just the condition. */ -static gimple +static gimple_cond gimple_build_cond_empty (tree cond) { enum tree_code pred_code; @@ -5592,7 +5592,7 @@ expand_omp_for_generic (struct omp_region *region, basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, collapse_bb; basic_block l2_bb = NULL, l3_bb = NULL; gimple_stmt_iterator gsi; - gimple stmt; + gimple_assign assign_stmt; bool in_combined_parallel = is_combined_parallel (region); bool broken_loop = region->cont == NULL; edge e, ne; @@ -5807,8 +5807,8 @@ expand_omp_for_generic (struct omp_region *region, DECL_P (startvar) && TREE_ADDRESSABLE (startvar), NULL_TREE, false, GSI_CONTINUE_LINKING); - stmt = gimple_build_assign (startvar, t); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (startvar, t); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); t = iend0; if (bias) @@ -5820,14 +5820,14 @@ expand_omp_for_generic (struct omp_region *region, false, GSI_CONTINUE_LINKING); if (endvar) { - stmt = gimple_build_assign (endvar, iend); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (endvar, iend); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); if (useless_type_conversion_p (TREE_TYPE (fd->loop.v), TREE_TYPE (iend))) - stmt = gimple_build_assign (fd->loop.v, iend); + assign_stmt = gimple_build_assign (fd->loop.v, iend); else - stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, iend, + assign_stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, iend, NULL_TREE); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); } if (fd->collapse > 1) expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar); @@ -5837,10 +5837,11 @@ expand_omp_for_generic (struct omp_region *region, /* Code to control the increment and predicate for the sequential loop goes in the CONT_BB. */ gsi = gsi_last_bb (cont_bb); - stmt = gsi_stmt (gsi); - gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE); - vmain = gimple_omp_continue_control_use (stmt); - vback = gimple_omp_continue_control_def (stmt); + gimple_omp_continue cont_stmt = + as_a (gsi_stmt (gsi)); + gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE); + vmain = gimple_omp_continue_control_use (cont_stmt); + vback = gimple_omp_continue_control_def (cont_stmt); if (!gimple_omp_for_combined_p (fd->for_stmt)) { @@ -5852,14 +5853,14 @@ expand_omp_for_generic (struct omp_region *region, DECL_P (vback) && TREE_ADDRESSABLE (vback), NULL_TREE, true, GSI_SAME_STMT); - stmt = gimple_build_assign (vback, t); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + assign_stmt = gimple_build_assign (vback, t); + 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, iend); - stmt = gimple_build_cond_empty (t); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + gimple_cond cond_stmt = gimple_build_cond_empty (t); + gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); } /* Remove GIMPLE_OMP_CONTINUE. */ @@ -5879,8 +5880,8 @@ expand_omp_for_generic (struct omp_region *region, if (TREE_TYPE (t) != boolean_type_node) t = fold_build2 (NE_EXPR, boolean_type_node, t, build_int_cst (TREE_TYPE (t), 0)); - stmt = gimple_build_cond_empty (t); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + gimple_cond cond_stmt = gimple_build_cond_empty (t); + gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING); } /* Add the loop cleanup function. */ @@ -5891,10 +5892,10 @@ expand_omp_for_generic (struct omp_region *region, t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_CANCEL); else t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END); - stmt = gimple_build_call (t, 0); + gimple_call call_stmt = gimple_build_call (t, 0); if (gimple_omp_return_lhs (gsi_stmt (gsi))) - gimple_call_set_lhs (stmt, gimple_omp_return_lhs (gsi_stmt (gsi))); - gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); + gimple_call_set_lhs (call_stmt, gimple_omp_return_lhs (gsi_stmt (gsi))); + gsi_insert_after (&gsi, call_stmt, GSI_SAME_STMT); gsi_remove (&gsi, true); /* Connect the new blocks. */ @@ -6017,7 +6018,6 @@ expand_omp_for_static_nochunk (struct omp_region *region, basic_block body_bb, cont_bb, collapse_bb = NULL; basic_block fin_bb; gimple_stmt_iterator gsi; - gimple stmt; edge ep; enum built_in_function get_num_threads = BUILT_IN_OMP_GET_NUM_THREADS; enum built_in_function get_thread_num = BUILT_IN_OMP_GET_THREAD_NUM; @@ -6081,18 +6081,18 @@ expand_omp_for_static_nochunk (struct omp_region *region, n2 = fold_convert (type, unshare_expr (fd->loop.n2)); n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE, true, GSI_SAME_STMT); - stmt = gimple_build_cond (fd->loop.cond_code, n1, n2, - NULL_TREE, NULL_TREE); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); - if (walk_tree (gimple_cond_lhs_ptr (stmt), + gimple_cond cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2, + NULL_TREE, NULL_TREE); + gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); + if (walk_tree (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p, NULL, NULL) - || walk_tree (gimple_cond_rhs_ptr (stmt), + || walk_tree (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p, NULL, NULL)) { - gsi = gsi_for_stmt (stmt); - gimple_regimplify_operands (stmt, &gsi); + gsi = gsi_for_stmt (cond_stmt); + gimple_regimplify_operands (cond_stmt, &gsi); } - ep = split_block (entry_bb, stmt); + ep = split_block (entry_bb, cond_stmt); ep->flags = EDGE_TRUE_VALUE; entry_bb = ep->dest; ep->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / 2000 - 1); @@ -6167,20 +6167,21 @@ expand_omp_for_static_nochunk (struct omp_region *region, gsi_insert_before (&gsi, gimple_build_assign (tt, t), GSI_SAME_STMT); t = build2 (LT_EXPR, boolean_type_node, threadid, tt); - stmt = gimple_build_cond_empty (t); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + gimple_cond cond_stmt = gimple_build_cond_empty (t); + gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); - second_bb = split_block (entry_bb, stmt)->dest; + second_bb = split_block (entry_bb, cond_stmt)->dest; gsi = gsi_last_bb (second_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); gsi_insert_before (&gsi, gimple_build_assign (tt, build_int_cst (itype, 0)), GSI_SAME_STMT); - stmt = gimple_build_assign_with_ops (PLUS_EXPR, q, q, - build_int_cst (itype, 1)); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + gimple_assign assign_stmt = + gimple_build_assign_with_ops (PLUS_EXPR, q, q, + build_int_cst (itype, 1)); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); - third_bb = split_block (second_bb, stmt)->dest; + third_bb = split_block (second_bb, assign_stmt)->dest; gsi = gsi_last_bb (third_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); @@ -6227,8 +6228,8 @@ expand_omp_for_static_nochunk (struct omp_region *region, DECL_P (startvar) && TREE_ADDRESSABLE (startvar), NULL_TREE, false, GSI_CONTINUE_LINKING); - stmt = gimple_build_assign (startvar, t); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (startvar, t); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); t = fold_convert (itype, e0); t = fold_build2 (MULT_EXPR, itype, t, step); @@ -6241,14 +6242,14 @@ expand_omp_for_static_nochunk (struct omp_region *region, false, GSI_CONTINUE_LINKING); if (endvar) { - stmt = gimple_build_assign (endvar, e); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (endvar, e); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); if (useless_type_conversion_p (TREE_TYPE (fd->loop.v), TREE_TYPE (e))) - stmt = gimple_build_assign (fd->loop.v, e); + assign_stmt = gimple_build_assign (fd->loop.v, e); else - stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e, + assign_stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e, NULL_TREE); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); } if (fd->collapse > 1) expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar); @@ -6258,10 +6259,11 @@ expand_omp_for_static_nochunk (struct omp_region *region, /* The code controlling the sequential loop replaces the GIMPLE_OMP_CONTINUE. */ gsi = gsi_last_bb (cont_bb); - stmt = gsi_stmt (gsi); - gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE); - vmain = gimple_omp_continue_control_use (stmt); - vback = gimple_omp_continue_control_def (stmt); + gimple_omp_continue cont_stmt = + as_a (gsi_stmt (gsi)); + gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE); + vmain = gimple_omp_continue_control_use (cont_stmt); + vback = gimple_omp_continue_control_def (cont_stmt); if (!gimple_omp_for_combined_p (fd->for_stmt)) { @@ -6273,8 +6275,8 @@ expand_omp_for_static_nochunk (struct omp_region *region, DECL_P (vback) && TREE_ADDRESSABLE (vback), NULL_TREE, true, GSI_SAME_STMT); - stmt = gimple_build_assign (vback, t); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + assign_stmt = gimple_build_assign (vback, t); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); t = build2 (fd->loop.cond_code, boolean_type_node, DECL_P (vback) && TREE_ADDRESSABLE (vback) @@ -6394,7 +6396,6 @@ expand_omp_for_static_chunk (struct omp_region *region, basic_block entry_bb, exit_bb, body_bb, seq_start_bb, iter_part_bb; basic_block trip_update_bb = NULL, cont_bb, collapse_bb = NULL, fin_bb; gimple_stmt_iterator gsi; - gimple stmt; edge se; enum built_in_function get_num_threads = BUILT_IN_OMP_GET_NUM_THREADS; enum built_in_function get_thread_num = BUILT_IN_OMP_GET_THREAD_NUM; @@ -6462,18 +6463,18 @@ expand_omp_for_static_chunk (struct omp_region *region, n2 = fold_convert (type, unshare_expr (fd->loop.n2)); n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE, true, GSI_SAME_STMT); - stmt = gimple_build_cond (fd->loop.cond_code, n1, n2, - NULL_TREE, NULL_TREE); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); - if (walk_tree (gimple_cond_lhs_ptr (stmt), + gimple_cond cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2, + NULL_TREE, NULL_TREE); + gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); + if (walk_tree (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p, NULL, NULL) - || walk_tree (gimple_cond_rhs_ptr (stmt), + || walk_tree (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p, NULL, NULL)) { - gsi = gsi_for_stmt (stmt); - gimple_regimplify_operands (stmt, &gsi); + gsi = gsi_for_stmt (cond_stmt); + gimple_regimplify_operands (cond_stmt, &gsi); } - se = split_block (entry_bb, stmt); + se = split_block (entry_bb, cond_stmt); se->flags = EDGE_TRUE_VALUE; entry_bb = se->dest; se->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / 2000 - 1); @@ -6555,8 +6556,9 @@ expand_omp_for_static_chunk (struct omp_region *region, trip_back = trip_var; } - stmt = gimple_build_assign (trip_init, build_int_cst (itype, 0)); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + gimple_assign assign_stmt = + gimple_build_assign (trip_init, build_int_cst (itype, 0)); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); t = fold_build2 (MULT_EXPR, itype, threadid, fd->chunk_size); t = fold_build2 (MULT_EXPR, itype, t, step); @@ -6618,8 +6620,8 @@ expand_omp_for_static_chunk (struct omp_region *region, DECL_P (startvar) && TREE_ADDRESSABLE (startvar), NULL_TREE, false, GSI_CONTINUE_LINKING); - stmt = gimple_build_assign (startvar, t); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (startvar, t); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); t = fold_convert (itype, e0); t = fold_build2 (MULT_EXPR, itype, t, step); @@ -6632,14 +6634,14 @@ expand_omp_for_static_chunk (struct omp_region *region, false, GSI_CONTINUE_LINKING); if (endvar) { - stmt = gimple_build_assign (endvar, e); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (endvar, e); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); if (useless_type_conversion_p (TREE_TYPE (fd->loop.v), TREE_TYPE (e))) - stmt = gimple_build_assign (fd->loop.v, e); + assign_stmt = gimple_build_assign (fd->loop.v, e); else - stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e, - NULL_TREE); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e, + NULL_TREE); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); } if (fd->collapse > 1) expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar); @@ -6649,10 +6651,10 @@ expand_omp_for_static_chunk (struct omp_region *region, /* The code controlling the sequential loop goes in CONT_BB, replacing the GIMPLE_OMP_CONTINUE. */ gsi = gsi_last_bb (cont_bb); - stmt = gsi_stmt (gsi); - gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE); - vmain = gimple_omp_continue_control_use (stmt); - vback = gimple_omp_continue_control_def (stmt); + gimple_omp_continue cont_stmt = + as_a (gsi_stmt (gsi)); + vmain = gimple_omp_continue_control_use (cont_stmt); + vback = gimple_omp_continue_control_def (cont_stmt); if (!gimple_omp_for_combined_p (fd->for_stmt)) { @@ -6663,8 +6665,8 @@ expand_omp_for_static_chunk (struct omp_region *region, if (DECL_P (vback) && TREE_ADDRESSABLE (vback)) t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true, GSI_SAME_STMT); - stmt = gimple_build_assign (vback, t); - gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + assign_stmt = gimple_build_assign (vback, t); + gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); t = build2 (fd->loop.cond_code, boolean_type_node, DECL_P (vback) && TREE_ADDRESSABLE (vback) @@ -6683,8 +6685,8 @@ expand_omp_for_static_chunk (struct omp_region *region, t = build_int_cst (itype, 1); t = build2 (PLUS_EXPR, itype, trip_main, t); - stmt = gimple_build_assign (trip_back, t); - gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); + assign_stmt = gimple_build_assign (trip_back, t); + gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); } /* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing. */ @@ -7412,7 +7414,8 @@ expand_omp_sections (struct omp_region *region) unsigned len; basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb; gimple_stmt_iterator si, switch_si; - gimple sections_stmt, stmt, cont; + gimple sections_stmt, stmt; + gimple_omp_continue cont; edge_iterator ei; edge e; struct omp_region *inner; @@ -7493,7 +7496,7 @@ expand_omp_sections (struct omp_region *region) gcc_assert (gimple_code (gsi_stmt (switch_si)) == GIMPLE_OMP_SECTIONS_SWITCH); if (exit_reachable) { - cont = last_stmt (l1_bb); + cont = as_a (last_stmt (l1_bb)); gcc_assert (gimple_code (cont) == GIMPLE_OMP_CONTINUE); vmain = gimple_omp_continue_control_use (cont); vnext = gimple_omp_continue_control_def (cont); -- 2.11.4.GIT