gcc/ChangeLog.gimple-classes: * gimple.h (gimple_omp_for_kind): Strengthen param from const_gimple to const gomp_for *. (gimple_omp_for_combined_p): Likewise. (gimple_omp_for_combined_into_p): Likewise. (gimple_omp_for_clauses): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_for_clauses_ptr): Strengthen param from gimple to gomp_for *. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body_ptr): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_collapse): Strengthen param from gimple to const gomp_for *.
* gimple-walk.c (walk_gimple_op): Within case GIMPLE_OMP_FOR, introduce local "omp_for_stmt" via a checked cast and use it in place of "stmt" for typesafety. (walk_gimple_stmt): Add checked cast. * gimple.c (gimple_copy): Within case GIMPLE_OMP_FOR, introduce locals "omp_for_stmt" and "omp_for_copy" via checked casts and use them in place of "stmt" and "copy" for typesafety. * omp-low.c (determine_parallel_type): Add a checked cast. (build_outer_var_ref): Likewise. (find_combined_for): Within case GIMPLE_OMP_FOR, introduce local "omp_for_stmt" via a checked cast and use it in place of "stmt" for typesafety. (check_omp_nesting_restrictions): Add checked casts. (check_omp_nesting_restrictions): Likewise. Within case GIMPLE_OMP_FOR, introduce local "omp_for_stmt" via a checked cast and use it in place of "stmt" for typesafety. (scan_omp_1_stmt): Add checked cast. (lower_rec_simd_input_clauses): Likewise. (lower_rec_input_clauses): Likewise. Introduce two locals named "omp_for_ctx_stmt" via checked casts and use them in place of "ctx->stmt" for typesafety. (lower_lastprivate_clauses): Add checked cast. (lower_reduction_clauses): Likewise. (expand_omp_for_init_vars): Likewise. (expand_omp_for_generic): Introduce local "omp_for_inner_stmt" via a checked cast and use in place of "inner_stmt" for typesafety. (expand_omp_for_static_nochunk): Add checked cast. (expand_omp_for_static_chunk): Likewise. (expand_omp_for): Introduce local "omp_for_stmt" via a checked cast and use in place of "last_stmt (region->entry)" for typesafety. (expand_omp): Add a checked cast. (diagnose_sb_0): Add checked casts. (diagnose_sb_1): Within case GIMPLE_OMP_FOR, introduce local "omp_for_stmt" via a checked cast and use it in place of "stmt" for typesafety. (diagnose_sb_2): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise, introducing locals "omp_for_stmt" and "omp_for_copy", using in place of "stmt" and "copy". (estimate_num_insns): Likewise, introducing local "omp_for_stmt" for use in place of "stmt". * tree-nested.c (convert_nonlocal_reference_stmt): Likewise. (convert_local_reference_stmt): Likewise. (convert_gimple_call): Add a checked cast. --- gcc/ChangeLog.gimple-classes | 76 ++++++++++++++++++++ gcc/gimple-walk.c | 54 +++++++------- gcc/gimple.c | 39 +++++----- gcc/gimple.h | 136 ++++++++++++----------------------- gcc/omp-low.c | 167 ++++++++++++++++++++++++++----------------- gcc/tree-inline.c | 52 +++++++++----- gcc/tree-nested.c | 42 ++++++----- 7 files changed, 330 insertions(+), 236 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 07ebee7..68add33 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,81 @@ 2014-10-29 David Malcolm <dmalc...@redhat.com> + * gimple.h (gimple_omp_for_kind): Strengthen param from + const_gimple to const gomp_for *. + (gimple_omp_for_combined_p): Likewise. + (gimple_omp_for_combined_into_p): Likewise. + (gimple_omp_for_clauses): Likewise. + (gimple_omp_for_index): Likewise. + (gimple_omp_for_initial): Likewise. + (gimple_omp_for_final): Likewise. + (gimple_omp_for_incr): Likewise. + (gimple_omp_for_pre_body): Likewise. + (gimple_omp_for_cond): Likewise. + (gimple_omp_for_clauses_ptr): Strengthen param from gimple to + gomp_for *. + (gimple_omp_for_set_clauses): Likewise. + (gimple_omp_for_index_ptr): Likewise. + (gimple_omp_for_set_index): Likewise. + (gimple_omp_for_initial_ptr): Likewise. + (gimple_omp_for_set_initial): Likewise. + (gimple_omp_for_final_ptr): Likewise. + (gimple_omp_for_set_final): Likewise. + (gimple_omp_for_incr_ptr): Likewise. + (gimple_omp_for_set_incr): Likewise. + (gimple_omp_for_pre_body_ptr): Likewise. + (gimple_omp_for_set_pre_body): Likewise. + (gimple_omp_for_set_cond): Likewise. + (gimple_omp_for_collapse): Strengthen param from gimple to + const gomp_for *. + + * gimple-walk.c (walk_gimple_op): Within case GIMPLE_OMP_FOR, + introduce local "omp_for_stmt" via a checked cast and use it in + place of "stmt" for typesafety. + (walk_gimple_stmt): Add checked cast. + * gimple.c (gimple_copy): Within case GIMPLE_OMP_FOR, introduce + locals "omp_for_stmt" and "omp_for_copy" via checked casts and use + them in place of "stmt" and "copy" for typesafety. + * omp-low.c (determine_parallel_type): Add a checked cast. + (build_outer_var_ref): Likewise. + (find_combined_for): Within case GIMPLE_OMP_FOR, + introduce local "omp_for_stmt" via a checked cast and use it in + place of "stmt" for typesafety. + (check_omp_nesting_restrictions): Add checked casts. + (check_omp_nesting_restrictions): Likewise. Within + case GIMPLE_OMP_FOR, introduce local "omp_for_stmt" via a checked + cast and use it in place of "stmt" for typesafety. + (scan_omp_1_stmt): Add checked cast. + (lower_rec_simd_input_clauses): Likewise. + (lower_rec_input_clauses): Likewise. Introduce two locals named + "omp_for_ctx_stmt" via checked casts and use them in place of + "ctx->stmt" for typesafety. + (lower_lastprivate_clauses): Add checked cast. + (lower_reduction_clauses): Likewise. + (expand_omp_for_init_vars): Likewise. + (expand_omp_for_generic): Introduce local "omp_for_inner_stmt" via + a checked cast and use in place of "inner_stmt" for typesafety. + (expand_omp_for_static_nochunk): Add checked cast. + (expand_omp_for_static_chunk): Likewise. + (expand_omp_for): Introduce local "omp_for_stmt" via a checked + cast and use in place of "last_stmt (region->entry)" for + typesafety. + (expand_omp): Add a checked cast. + (diagnose_sb_0): Add checked casts. + (diagnose_sb_1): Within case GIMPLE_OMP_FOR, introduce local + "omp_for_stmt" via a checked cast and use it in place of "stmt" for + typesafety. + (diagnose_sb_2): Likewise. + * tree-inline.c (remap_gimple_stmt): Likewise, introducing locals + "omp_for_stmt" and "omp_for_copy", using in place of "stmt" and + "copy". + (estimate_num_insns): Likewise, introducing local "omp_for_stmt" + for use in place of "stmt". + * tree-nested.c (convert_nonlocal_reference_stmt): Likewise. + (convert_local_reference_stmt): Likewise. + (convert_gimple_call): Add a checked cast. + +2014-10-29 David Malcolm <dmalc...@redhat.com> + * gimple.h (gimple_omp_task_clauses): Strengthen param from const_gimple to const gomp_task *. (gimple_omp_task_child_fn): Likewise. diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index 020e55f..28648c4 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -329,29 +329,32 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, break; case GIMPLE_OMP_FOR: - ret = walk_tree (gimple_omp_for_clauses_ptr (stmt), callback_op, wi, - pset); - if (ret) - return ret; - for (i = 0; i < gimple_omp_for_collapse (stmt); i++) - { - ret = walk_tree (gimple_omp_for_index_ptr (stmt, i), callback_op, - wi, pset); - if (ret) - return ret; - ret = walk_tree (gimple_omp_for_initial_ptr (stmt, i), callback_op, - wi, pset); - if (ret) - return ret; - ret = walk_tree (gimple_omp_for_final_ptr (stmt, i), callback_op, - wi, pset); - if (ret) - return ret; - ret = walk_tree (gimple_omp_for_incr_ptr (stmt, i), callback_op, - wi, pset); - } - if (ret) - return ret; + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + ret = walk_tree (gimple_omp_for_clauses_ptr (omp_for_stmt), callback_op, wi, + pset); + if (ret) + return ret; + for (i = 0; i < gimple_omp_for_collapse (omp_for_stmt); i++) + { + ret = walk_tree (gimple_omp_for_index_ptr (omp_for_stmt, i), + callback_op, wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_for_initial_ptr (omp_for_stmt, i), + callback_op, wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_for_final_ptr (omp_for_stmt, i), + callback_op, wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_for_incr_ptr (omp_for_stmt, i), + callback_op, wi, pset); + } + if (ret) + return ret; + } break; case GIMPLE_OMP_PARALLEL: @@ -619,8 +622,9 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, break; case GIMPLE_OMP_FOR: - ret = walk_gimple_seq_mod (gimple_omp_for_pre_body_ptr (stmt), callback_stmt, - callback_op, wi); + ret = walk_gimple_seq_mod (gimple_omp_for_pre_body_ptr ( + as_a <gomp_for *> (stmt)), + callback_stmt, callback_op, wi); if (ret) return wi->callback_result; diff --git a/gcc/gimple.c b/gcc/gimple.c index 7021300..f02930d 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1731,28 +1731,29 @@ gimple_copy (gimple stmt) break; case GIMPLE_OMP_FOR: - new_seq = gimple_seq_copy (gimple_omp_for_pre_body (stmt)); - gimple_omp_for_set_pre_body (copy, new_seq); - t = unshare_expr (gimple_omp_for_clauses (stmt)); - gimple_omp_for_set_clauses (copy, t); { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); gomp_for *omp_for_copy = as_a <gomp_for *> (copy); + new_seq = gimple_seq_copy (gimple_omp_for_pre_body (omp_for_stmt)); + gimple_omp_for_set_pre_body (omp_for_copy, new_seq); + t = unshare_expr (gimple_omp_for_clauses (omp_for_stmt)); + gimple_omp_for_set_clauses (omp_for_copy, t); omp_for_copy->iter = ggc_vec_alloc<gimple_omp_for_iter> - ( gimple_omp_for_collapse (stmt)); - } - for (i = 0; i < gimple_omp_for_collapse (stmt); i++) - { - gimple_omp_for_set_cond (copy, i, - gimple_omp_for_cond (stmt, i)); - gimple_omp_for_set_index (copy, i, - gimple_omp_for_index (stmt, i)); - t = unshare_expr (gimple_omp_for_initial (stmt, i)); - gimple_omp_for_set_initial (copy, i, t); - t = unshare_expr (gimple_omp_for_final (stmt, i)); - gimple_omp_for_set_final (copy, i, t); - t = unshare_expr (gimple_omp_for_incr (stmt, i)); - gimple_omp_for_set_incr (copy, i, t); - } + ( gimple_omp_for_collapse (omp_for_stmt)); + for (i = 0; i < gimple_omp_for_collapse (omp_for_stmt); i++) + { + gimple_omp_for_set_cond (omp_for_copy, i, + gimple_omp_for_cond (omp_for_stmt, i)); + gimple_omp_for_set_index (omp_for_copy, i, + gimple_omp_for_index (omp_for_stmt, i)); + t = unshare_expr (gimple_omp_for_initial (omp_for_stmt, i)); + gimple_omp_for_set_initial (omp_for_copy, i, t); + t = unshare_expr (gimple_omp_for_final (omp_for_stmt, i)); + gimple_omp_for_set_final (omp_for_copy, i, t); + t = unshare_expr (gimple_omp_for_incr (omp_for_stmt, i)); + gimple_omp_for_set_incr (omp_for_copy, i, t); + } + } goto copy_omp_body; case GIMPLE_OMP_PARALLEL: diff --git a/gcc/gimple.h b/gcc/gimple.h index ef1f4f7..6df9dbf 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -4333,9 +4333,8 @@ gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name) /* Return the kind of OMP for statemement. */ static inline int -gimple_omp_for_kind (const_gimple g) +gimple_omp_for_kind (const gomp_for *g) { - GIMPLE_CHECK (g, GIMPLE_OMP_FOR); return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK); } @@ -4354,9 +4353,8 @@ gimple_omp_for_set_kind (gomp_for *g, int kind) GF_OMP_FOR_COMBINED flag set. */ static inline bool -gimple_omp_for_combined_p (const_gimple g) +gimple_omp_for_combined_p (const gomp_for *g) { - GIMPLE_CHECK (g, GIMPLE_OMP_FOR); return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0; } @@ -4378,9 +4376,8 @@ gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p) GF_OMP_FOR_COMBINED_INTO flag set. */ static inline bool -gimple_omp_for_combined_into_p (const_gimple g) +gimple_omp_for_combined_into_p (const gomp_for *g) { - GIMPLE_CHECK (g, GIMPLE_OMP_FOR); return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0; } @@ -4398,224 +4395,189 @@ gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p) } -/* Return the clauses associated with OMP_FOR GS. */ +/* Return the clauses associated with OMP_FOR OMP_FOR_STMT. */ static inline tree -gimple_omp_for_clauses (const_gimple gs) +gimple_omp_for_clauses (const gomp_for *omp_for_stmt) { - const gomp_for *omp_for_stmt = - as_a <const gomp_for *> (gs); return omp_for_stmt->clauses; } -/* Return a pointer to the OMP_FOR GS. */ +/* Return a pointer to the OMP_FOR OMP_FOR_STMT. */ static inline tree * -gimple_omp_for_clauses_ptr (gimple gs) +gimple_omp_for_clauses_ptr (gomp_for *omp_for_stmt) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); return &omp_for_stmt->clauses; } -/* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */ +/* Set CLAUSES to be the list of clauses associated with OMP_FOR + OMP_FOR_STMT. */ static inline void -gimple_omp_for_set_clauses (gimple gs, tree clauses) +gimple_omp_for_set_clauses (gomp_for *omp_for_stmt, tree clauses) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); omp_for_stmt->clauses = clauses; } -/* Get the collapse count of OMP_FOR GS. */ +/* Get the collapse count of OMP_FOR OMP_FOR_STMT. */ static inline size_t -gimple_omp_for_collapse (gimple gs) +gimple_omp_for_collapse (const gomp_for *omp_for_stmt) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); return omp_for_stmt->collapse; } -/* Return the index variable for OMP_FOR GS. */ +/* Return the index variable for OMP_FOR OMP_FOR_STMT. */ static inline tree -gimple_omp_for_index (const_gimple gs, size_t i) +gimple_omp_for_index (const gomp_for *omp_for_stmt, size_t i) { - const gomp_for *omp_for_stmt = - as_a <const gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return omp_for_stmt->iter[i].index; } -/* Return a pointer to the index variable for OMP_FOR GS. */ +/* Return a pointer to the index variable for OMP_FOR OMP_FOR_STMT. */ static inline tree * -gimple_omp_for_index_ptr (gimple gs, size_t i) +gimple_omp_for_index_ptr (gomp_for *omp_for_stmt, size_t i) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return &omp_for_stmt->iter[i].index; } -/* Set INDEX to be the index variable for OMP_FOR GS. */ +/* Set INDEX to be the index variable for OMP_FOR OMP_FOR_STMT. */ static inline void -gimple_omp_for_set_index (gimple gs, size_t i, tree index) +gimple_omp_for_set_index (gomp_for *omp_for_stmt, size_t i, tree index) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); omp_for_stmt->iter[i].index = index; } -/* Return the initial value for OMP_FOR GS. */ +/* Return the initial value for OMP_FOR OMP_FOR_STMT. */ static inline tree -gimple_omp_for_initial (const_gimple gs, size_t i) +gimple_omp_for_initial (const gomp_for *omp_for_stmt, size_t i) { - const gomp_for *omp_for_stmt = - as_a <const gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return omp_for_stmt->iter[i].initial; } -/* Return a pointer to the initial value for OMP_FOR GS. */ +/* Return a pointer to the initial value for OMP_FOR OMP_FOR_STMT. */ static inline tree * -gimple_omp_for_initial_ptr (gimple gs, size_t i) +gimple_omp_for_initial_ptr (gomp_for *omp_for_stmt, size_t i) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return &omp_for_stmt->iter[i].initial; } -/* Set INITIAL to be the initial value for OMP_FOR GS. */ +/* Set INITIAL to be the initial value for OMP_FOR OMP_FOR_STMT. */ static inline void -gimple_omp_for_set_initial (gimple gs, size_t i, tree initial) +gimple_omp_for_set_initial (gomp_for *omp_for_stmt, size_t i, tree initial) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); omp_for_stmt->iter[i].initial = initial; } -/* Return the final value for OMP_FOR GS. */ +/* Return the final value for OMP_FOR OMP_FOR_STMT. */ static inline tree -gimple_omp_for_final (const_gimple gs, size_t i) +gimple_omp_for_final (const gomp_for *omp_for_stmt, size_t i) { - const gomp_for *omp_for_stmt = - as_a <const gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return omp_for_stmt->iter[i].final; } -/* Return a pointer to the final value for OMP_FOR GS. */ +/* Return a pointer to the final value for OMP_FOR OMP_FOR_STMT. */ static inline tree * -gimple_omp_for_final_ptr (gimple gs, size_t i) +gimple_omp_for_final_ptr (gomp_for *omp_for_stmt, size_t i) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return &omp_for_stmt->iter[i].final; } -/* Set FINAL to be the final value for OMP_FOR GS. */ +/* Set FINAL to be the final value for OMP_FOR OMP_FOR_STMT. */ static inline void -gimple_omp_for_set_final (gimple gs, size_t i, tree final) +gimple_omp_for_set_final (gomp_for *omp_for_stmt, size_t i, tree final) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); omp_for_stmt->iter[i].final = final; } -/* Return the increment value for OMP_FOR GS. */ +/* Return the increment value for OMP_FOR OMP_FOR_STMT. */ static inline tree -gimple_omp_for_incr (const_gimple gs, size_t i) +gimple_omp_for_incr (const gomp_for *omp_for_stmt, size_t i) { - const gomp_for *omp_for_stmt = - as_a <const gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return omp_for_stmt->iter[i].incr; } -/* Return a pointer to the increment value for OMP_FOR GS. */ +/* Return a pointer to the increment value for OMP_FOR OMP_FOR_STMT. */ static inline tree * -gimple_omp_for_incr_ptr (gimple gs, size_t i) +gimple_omp_for_incr_ptr (gomp_for *omp_for_stmt, size_t i) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return &omp_for_stmt->iter[i].incr; } -/* Set INCR to be the increment value for OMP_FOR GS. */ +/* Set INCR to be the increment value for OMP_FOR OMP_FOR_STMT. */ static inline void -gimple_omp_for_set_incr (gimple gs, size_t i, tree incr) +gimple_omp_for_set_incr (gomp_for *omp_for_stmt, size_t i, tree incr) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); omp_for_stmt->iter[i].incr = incr; } /* Return a pointer to the sequence of statements to execute before the OMP_FOR - statement GS starts. */ + statement OMP_FOR_STMT starts. */ static inline gimple_seq * -gimple_omp_for_pre_body_ptr (gimple gs) +gimple_omp_for_pre_body_ptr (gomp_for *omp_for_stmt) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); return &omp_for_stmt->pre_body; } /* Return the sequence of statements to execute before the OMP_FOR - statement GS starts. */ + statement OMP_FOR_STMT starts. */ static inline gimple_seq -gimple_omp_for_pre_body (gimple gs) +gimple_omp_for_pre_body (gomp_for *omp_for_stmt) { - return *gimple_omp_for_pre_body_ptr (gs); + return *gimple_omp_for_pre_body_ptr (omp_for_stmt); } /* Set PRE_BODY to be the sequence of statements to execute before the - OMP_FOR statement GS starts. */ + OMP_FOR statement OMP_FOR_STMT starts. */ static inline void -gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body) +gimple_omp_for_set_pre_body (gomp_for *omp_for_stmt, gimple_seq pre_body) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); omp_for_stmt->pre_body = pre_body; } @@ -5216,26 +5178,22 @@ gimple_omp_sections_set_control (gimple gs, tree control) } -/* Set COND to be the condition code for OMP_FOR GS. */ +/* Set COND to be the condition code for OMP_FOR OMP_FOR_STMT. */ static inline void -gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond) +gimple_omp_for_set_cond (gomp_for *omp_for_stmt, size_t i, enum tree_code cond) { - gomp_for *omp_for_stmt = - as_a <gomp_for *> (gs); gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison && i < omp_for_stmt->collapse); omp_for_stmt->iter[i].cond = cond; } -/* Return the condition code associated with OMP_FOR GS. */ +/* Return the condition code associated with OMP_FOR OMP_FOR_STMT. */ static inline enum tree_code -gimple_omp_for_cond (const_gimple gs, size_t i) +gimple_omp_for_cond (const gomp_for *omp_for_stmt, size_t i) { - const gomp_for *omp_for_stmt = - as_a <const gomp_for *> (gs); gcc_gimple_checking_assert (i < omp_for_stmt->collapse); return omp_for_stmt->iter[i].cond; } diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 2f28761..c43f5ea 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -785,7 +785,7 @@ determine_parallel_type (struct omp_region *region) parallel loop call would still need extra synchronization to implement ordered semantics, so there would not be any gain in using the combined call. */ - tree clauses = gimple_omp_for_clauses (ws_stmt); + tree clauses = gimple_omp_for_clauses (as_a <gomp_for *> (ws_stmt)); tree c = find_omp_clause (clauses, OMP_CLAUSE_SCHEDULE); if (c == NULL || OMP_CLAUSE_SCHEDULE_KIND (c) == OMP_CLAUSE_SCHEDULE_STATIC @@ -1034,7 +1034,8 @@ build_outer_var_ref (tree var, omp_context *ctx) x = build_receiver_ref (var, by_ref, ctx); } else if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD) + && (gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) + & GF_OMP_FOR_SIMD)) { /* #pragma omp simd isn't a worksharing construct, and can reference even private vars in its linear etc. clauses. */ @@ -2039,12 +2040,15 @@ find_combined_for (gimple_stmt_iterator *gsi_p, WALK_SUBSTMTS; case GIMPLE_OMP_FOR: - if (gimple_omp_for_combined_into_p (stmt) - && gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_FOR) - { - wi->info = stmt; - return integer_zero_node; - } + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + if (gimple_omp_for_combined_into_p (omp_for_stmt) + && gimple_omp_for_kind (omp_for_stmt) == GF_OMP_FOR_KIND_FOR) + { + wi->info = stmt; + return integer_zero_node; + } + } break; default: break; @@ -2404,7 +2408,8 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) if (ctx != NULL) { if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD) + && (gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) + & GF_OMP_FOR_SIMD)) { error_at (gimple_location (stmt), "OpenMP constructs may not be nested inside simd region"); @@ -2413,7 +2418,7 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) else if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS) { if ((gimple_code (stmt) != GIMPLE_OMP_FOR - || (gimple_omp_for_kind (stmt) + || (gimple_omp_for_kind (as_a <gomp_for *> (stmt)) != GF_OMP_FOR_KIND_DISTRIBUTE)) && gimple_code (stmt) != GIMPLE_OMP_PARALLEL) { @@ -2427,19 +2432,22 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) switch (gimple_code (stmt)) { case GIMPLE_OMP_FOR: - if (gimple_omp_for_kind (stmt) & GF_OMP_FOR_SIMD) - return true; - if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_DISTRIBUTE) - { - if (ctx != NULL && gimple_code (ctx->stmt) != GIMPLE_OMP_TEAMS) - { - error_at (gimple_location (stmt), - "distribute construct must be closely nested inside " - "teams construct"); - return false; - } + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + if (gimple_omp_for_kind (omp_for_stmt) & GF_OMP_FOR_SIMD) return true; - } + if (gimple_omp_for_kind (omp_for_stmt) == GF_OMP_FOR_KIND_DISTRIBUTE) + { + if (ctx != NULL && gimple_code (ctx->stmt) != GIMPLE_OMP_TEAMS) + { + error_at (gimple_location (stmt), + "distribute construct must be closely nested inside " + "teams construct"); + return false; + } + return true; + } + } /* FALLTHRU */ case GIMPLE_CALL: if (is_gimple_call (stmt) @@ -2474,19 +2482,22 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) break; case 2: if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR - || gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_FOR) + || (gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) + != GF_OMP_FOR_KIND_FOR)) bad = "#pragma omp for"; else if (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) == BUILT_IN_GOMP_CANCEL && !integer_zerop (gimple_call_arg (stmt, 1))) { ctx->cancellable = true; - if (find_omp_clause (gimple_omp_for_clauses (ctx->stmt), + if (find_omp_clause (gimple_omp_for_clauses ( + as_a <gomp_for *> (ctx->stmt)), OMP_CLAUSE_NOWAIT)) warning_at (gimple_location (stmt), 0, "%<#pragma omp cancel for%> inside " "%<nowait%> for construct"); - if (find_omp_clause (gimple_omp_for_clauses (ctx->stmt), + if (find_omp_clause (gimple_omp_for_clauses ( + as_a <gomp_for *> (ctx->stmt)), OMP_CLAUSE_ORDERED)) warning_at (gimple_location (stmt), 0, "%<#pragma omp cancel for%> inside " @@ -2614,7 +2625,8 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) "of critical or explicit task region"); return false; case GIMPLE_OMP_FOR: - if (find_omp_clause (gimple_omp_for_clauses (ctx->stmt), + if (find_omp_clause (gimple_omp_for_clauses ( + as_a <gomp_for *> (ctx->stmt)), OMP_CLAUSE_ORDERED) == NULL) { error_at (gimple_location (stmt), @@ -2774,7 +2786,8 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, if (setjmp_or_longjmp_p (fndecl) && ctx && gimple_code (ctx->stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD) + && (gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) + & GF_OMP_FOR_SIMD)) { remove = true; error_at (gimple_location (stmt), @@ -3141,7 +3154,8 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx, int &max_vf, max_vf = omp_max_vf (); if (max_vf > 1) { - tree c = find_omp_clause (gimple_omp_for_clauses (ctx->stmt), + tree c = find_omp_clause (gimple_omp_for_clauses ( + as_a <gomp_for *> (ctx->stmt)), OMP_CLAUSE_SAFELEN); if (c && TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST) max_vf = 1; @@ -3214,7 +3228,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, bool reduction_omp_orig_ref = false; int pass; bool is_simd = (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD); + && (gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) + & GF_OMP_FOR_SIMD)); int max_vf = 0; tree lane = NULL_TREE, idx = NULL_TREE; tree ivar = NULL_TREE, lvar = NULL_TREE; @@ -3561,7 +3576,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, if (is_simd) { if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR - && gimple_omp_for_combined_into_p (ctx->stmt)) + && gimple_omp_for_combined_into_p ( + as_a <gomp_for *> (ctx->stmt))) { tree t = OMP_CLAUSE_LINEAR_STEP (c); tree stept = TREE_TYPE (t); @@ -3612,7 +3628,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, x = lang_hooks.decls.omp_clause_copy_ctor (c, iv, x); gimplify_and_add (x, ilist); gimple_stmt_iterator gsi - = gsi_start_1 (gimple_omp_body_ptr (ctx->stmt)); + = gsi_start_1 (gimple_omp_body_ptr ( + as_a <gomp_for *> (ctx->stmt))); gassign *g = gimple_build_assign (unshare_expr (lvar), iv); gsi_insert_before_without_update (&gsi, g, @@ -3829,8 +3846,9 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, gsi_insert_before_without_update (&gsi, g, GSI_SAME_STMT); c = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE__SIMDUID_); OMP_CLAUSE__SIMDUID__DECL (c) = uid; - OMP_CLAUSE_CHAIN (c) = gimple_omp_for_clauses (ctx->stmt); - gimple_omp_for_set_clauses (ctx->stmt, c); + gomp_for *omp_for_ctx_stmt = as_a <gomp_for *> (ctx->stmt); + OMP_CLAUSE_CHAIN (c) = gimple_omp_for_clauses (omp_for_ctx_stmt); + gimple_omp_for_set_clauses (omp_for_ctx_stmt, c); g = gimple_build_assign_with_ops (INTEGER_CST, lane, build_int_cst (unsigned_type_node, 0), NULL_TREE); @@ -3886,7 +3904,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, /* Don't add any barrier for #pragma omp simd or #pragma omp distribute. */ if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR - || gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_FOR) + || (gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) + == GF_OMP_FOR_KIND_FOR)) gimple_seq_add_stmt (ilist, build_omp_barrier (NULL_TREE)); } @@ -3894,7 +3913,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, up to the max_vf we chose. So stick it into the safelen clause. */ if (max_vf) { - tree c = find_omp_clause (gimple_omp_for_clauses (ctx->stmt), + gomp_for *omp_for_ctx_stmt = as_a <gomp_for *> (ctx->stmt); + tree c = find_omp_clause (gimple_omp_for_clauses (omp_for_ctx_stmt), OMP_CLAUSE_SAFELEN); if (c == NULL_TREE || (TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) == INTEGER_CST @@ -3904,8 +3924,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, c = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE_SAFELEN); OMP_CLAUSE_SAFELEN_EXPR (c) = build_int_cst (integer_type_node, max_vf); - OMP_CLAUSE_CHAIN (c) = gimple_omp_for_clauses (ctx->stmt); - gimple_omp_for_set_clauses (ctx->stmt, c); + OMP_CLAUSE_CHAIN (c) = gimple_omp_for_clauses (omp_for_ctx_stmt); + gimple_omp_for_set_clauses (omp_for_ctx_stmt, c); } } } @@ -3966,7 +3986,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list, } if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD) + && gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) & GF_OMP_FOR_SIMD) { simduid = find_omp_clause (orig_clauses, OMP_CLAUSE__SIMDUID_); if (simduid) @@ -4069,7 +4089,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx) /* SIMD reductions are handled in lower_rec_input_clauses. */ if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD) + && gimple_omp_for_kind (as_a <gomp_for *> (ctx->stmt)) & GF_OMP_FOR_SIMD) return; /* First see if there is exactly one reduction clause. Use OMP_ATOMIC @@ -5355,7 +5375,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, tree clauses = gimple_code (inner_stmt) == GIMPLE_OMP_PARALLEL ? gimple_omp_parallel_clauses (inner_stmt) - : gimple_omp_for_clauses (inner_stmt); + : gimple_omp_for_clauses (as_a <gomp_for *> (inner_stmt)); /* First two _looptemp_ clauses are for istart/iend, counts[0] isn't supposed to be handled, as the inner loop doesn't use it. */ @@ -5802,10 +5822,12 @@ expand_omp_for_generic (struct omp_region *region, if (gimple_omp_for_combined_p (fd->for_stmt)) { - gcc_assert (gimple_code (inner_stmt) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (inner_stmt) - == GF_OMP_FOR_KIND_SIMD); - tree innerc = find_omp_clause (gimple_omp_for_clauses (inner_stmt), + gcc_assert (gimple_code (inner_stmt) == GIMPLE_OMP_FOR); + gomp_for *omp_for_inner_stmt = as_a <gomp_for *> (inner_stmt); + gcc_assert (gimple_omp_for_kind (omp_for_inner_stmt) + == GF_OMP_FOR_KIND_SIMD); + tree innerc = find_omp_clause (gimple_omp_for_clauses ( + omp_for_inner_stmt), OMP_CLAUSE__LOOPTEMP_); gcc_assert (innerc); startvar = OMP_CLAUSE_DECL (innerc); @@ -6227,7 +6249,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, { tree clauses = gimple_code (inner_stmt) == GIMPLE_OMP_PARALLEL ? gimple_omp_parallel_clauses (inner_stmt) - : gimple_omp_for_clauses (inner_stmt); + : gimple_omp_for_clauses (as_a <gomp_for *> (inner_stmt)); tree innerc = find_omp_clause (clauses, OMP_CLAUSE__LOOPTEMP_); gcc_assert (innerc); startvar = OMP_CLAUSE_DECL (innerc); @@ -6618,7 +6640,7 @@ expand_omp_for_static_chunk (struct omp_region *region, { tree clauses = gimple_code (inner_stmt) == GIMPLE_OMP_PARALLEL ? gimple_omp_parallel_clauses (inner_stmt) - : gimple_omp_for_clauses (inner_stmt); + : gimple_omp_for_clauses (as_a <gomp_for *> (inner_stmt)); tree innerc = find_omp_clause (clauses, OMP_CLAUSE__LOOPTEMP_); gcc_assert (innerc); startvar = OMP_CLAUSE_DECL (innerc); @@ -7335,13 +7357,13 @@ expand_omp_for (struct omp_region *region, gimple inner_stmt) { struct omp_for_data fd; struct omp_for_data_loop *loops; + gomp_for *omp_for_stmt = as_a <gomp_for *> (last_stmt (region->entry)); loops = (struct omp_for_data_loop *) - alloca (gimple_omp_for_collapse (last_stmt (region->entry)) + alloca (gimple_omp_for_collapse (omp_for_stmt) * sizeof (struct omp_for_data_loop)); - extract_omp_for_data (as_a <gomp_for *> (last_stmt (region->entry)), - &fd, loops); + extract_omp_for_data (omp_for_stmt, &fd, loops); region->sched_kind = fd.sched_kind; gcc_assert (EDGE_COUNT (region->entry->succs) == 2); @@ -8603,7 +8625,8 @@ expand_omp (struct omp_region *region) determine_parallel_type (region); if (region->type == GIMPLE_OMP_FOR - && gimple_omp_for_combined_p (last_stmt (region->entry))) + && gimple_omp_for_combined_p ( + as_a <gomp_for *> (last_stmt (region->entry)))) inner_stmt = last_stmt (region->inner->entry); if (region->inner) @@ -10808,10 +10831,12 @@ diagnose_sb_0 (gimple_stmt_iterator *gsi_p, { if ((branch_ctx && gimple_code (branch_ctx) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (branch_ctx) == GF_OMP_FOR_KIND_CILKSIMD) + && (gimple_omp_for_kind (as_a <gomp_for *> (branch_ctx)) + == GF_OMP_FOR_KIND_CILKSIMD)) || (label_ctx && gimple_code (label_ctx) == GIMPLE_OMP_FOR - && gimple_omp_for_kind (label_ctx) == GF_OMP_FOR_KIND_CILKSIMD)) + && (gimple_omp_for_kind (as_a <gomp_for *> (label_ctx)) + == GF_OMP_FOR_KIND_CILKSIMD))) cilkplus_block = true; } @@ -10872,14 +10897,18 @@ diagnose_sb_1 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p, break; case GIMPLE_OMP_FOR: - inner_context = stmt; - wi->info = inner_context; - /* gimple_omp_for_{index,initial,final} are all DECLs; no need to - walk them. */ - walk_gimple_seq (gimple_omp_for_pre_body (stmt), - diagnose_sb_1, NULL, wi); - walk_gimple_seq (gimple_omp_body (stmt), diagnose_sb_1, NULL, wi); - wi->info = context; + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + inner_context = stmt; + wi->info = inner_context; + /* gimple_omp_for_{index,initial,final} are all DECLs; no need to + walk them. */ + walk_gimple_seq (gimple_omp_for_pre_body (omp_for_stmt), + diagnose_sb_1, NULL, wi); + walk_gimple_seq (gimple_omp_body (omp_for_stmt), diagnose_sb_1, NULL, + wi); + wi->info = context; + } break; case GIMPLE_LABEL: @@ -10930,13 +10959,17 @@ diagnose_sb_2 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p, break; case GIMPLE_OMP_FOR: - wi->info = stmt; - /* gimple_omp_for_{index,initial,final} are all DECLs; no need to - walk them. */ - walk_gimple_seq_mod (gimple_omp_for_pre_body_ptr (stmt), - diagnose_sb_2, NULL, wi); - walk_gimple_seq_mod (gimple_omp_body_ptr (stmt), diagnose_sb_2, NULL, wi); - wi->info = context; + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + wi->info = stmt; + /* gimple_omp_for_{index,initial,final} are all DECLs; no need to + walk them. */ + walk_gimple_seq_mod (gimple_omp_for_pre_body_ptr (omp_for_stmt), + diagnose_sb_2, NULL, wi); + walk_gimple_seq_mod (gimple_omp_body_ptr (omp_for_stmt), diagnose_sb_2, + NULL, wi); + wi->info = context; + } break; case GIMPLE_COND: diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 8688a99..fd20bcb 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1402,25 +1402,34 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id) break; case GIMPLE_OMP_FOR: - s1 = remap_gimple_seq (gimple_omp_body (stmt), id); - s2 = remap_gimple_seq (gimple_omp_for_pre_body (stmt), id); - copy = gimple_build_omp_for (s1, gimple_omp_for_kind (stmt), - gimple_omp_for_clauses (stmt), - gimple_omp_for_collapse (stmt), s2); { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + gomp_for *omp_for_copy; size_t i; - for (i = 0; i < gimple_omp_for_collapse (stmt); i++) + s1 = remap_gimple_seq (gimple_omp_body (omp_for_stmt), id); + s2 = remap_gimple_seq (gimple_omp_for_pre_body (omp_for_stmt), id); + copy = omp_for_copy = + gimple_build_omp_for (s1, gimple_omp_for_kind (omp_for_stmt), + gimple_omp_for_clauses (omp_for_stmt), + gimple_omp_for_collapse (omp_for_stmt), + s2); + for (i = 0; i < gimple_omp_for_collapse (omp_for_stmt); i++) { - gimple_omp_for_set_index (copy, i, - gimple_omp_for_index (stmt, i)); - gimple_omp_for_set_initial (copy, i, - gimple_omp_for_initial (stmt, i)); - gimple_omp_for_set_final (copy, i, - gimple_omp_for_final (stmt, i)); - gimple_omp_for_set_incr (copy, i, - gimple_omp_for_incr (stmt, i)); - gimple_omp_for_set_cond (copy, i, - gimple_omp_for_cond (stmt, i)); + gimple_omp_for_set_index (omp_for_copy, i, + gimple_omp_for_index (omp_for_stmt, + i)); + gimple_omp_for_set_initial (omp_for_copy, i, + gimple_omp_for_initial ( + omp_for_stmt, i)); + gimple_omp_for_set_final (omp_for_copy, i, + gimple_omp_for_final (omp_for_stmt, + i)); + gimple_omp_for_set_incr (omp_for_copy, i, + gimple_omp_for_incr (omp_for_stmt, + i)); + gimple_omp_for_set_cond (omp_for_copy, i, + gimple_omp_for_cond (omp_for_stmt, + i)); } } break; @@ -4036,9 +4045,14 @@ estimate_num_insns (gimple stmt, eni_weights *weights) return weights->omp_cost; case GIMPLE_OMP_FOR: - return (weights->omp_cost - + estimate_num_insns_seq (gimple_omp_body (stmt), weights) - + estimate_num_insns_seq (gimple_omp_for_pre_body (stmt), weights)); + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + return (weights->omp_cost + + estimate_num_insns_seq (gimple_omp_body (omp_for_stmt), + weights) + + estimate_num_insns_seq (gimple_omp_for_pre_body (omp_for_stmt), + weights)); + } case GIMPLE_OMP_PARALLEL: case GIMPLE_OMP_TASK: diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index c95fe81..95ecbc0 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1350,14 +1350,18 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, break; case GIMPLE_OMP_FOR: - save_suppress = info->suppress_expansion; - convert_nonlocal_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi); - walk_gimple_omp_for (as_a <gomp_for *> (stmt), - convert_nonlocal_reference_stmt, - convert_nonlocal_reference_op, info); - walk_body (convert_nonlocal_reference_stmt, - convert_nonlocal_reference_op, info, gimple_omp_body_ptr (stmt)); - info->suppress_expansion = save_suppress; + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + save_suppress = info->suppress_expansion; + convert_nonlocal_omp_clauses (gimple_omp_for_clauses_ptr (omp_for_stmt), wi); + walk_gimple_omp_for (omp_for_stmt, + convert_nonlocal_reference_stmt, + convert_nonlocal_reference_op, info); + walk_body (convert_nonlocal_reference_stmt, + convert_nonlocal_reference_op, info, + gimple_omp_body_ptr (omp_for_stmt)); + info->suppress_expansion = save_suppress; + } break; case GIMPLE_OMP_SECTIONS: @@ -1919,14 +1923,18 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, break; case GIMPLE_OMP_FOR: - save_suppress = info->suppress_expansion; - convert_local_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi); - walk_gimple_omp_for (as_a <gomp_for *> (stmt), - convert_local_reference_stmt, - convert_local_reference_op, info); - walk_body (convert_local_reference_stmt, convert_local_reference_op, - info, gimple_omp_body_ptr (stmt)); - info->suppress_expansion = save_suppress; + { + gomp_for *omp_for_stmt = as_a <gomp_for *> (stmt); + save_suppress = info->suppress_expansion; + convert_local_omp_clauses (gimple_omp_for_clauses_ptr (omp_for_stmt), + wi); + walk_gimple_omp_for (omp_for_stmt, + convert_local_reference_stmt, + convert_local_reference_op, info); + walk_body (convert_local_reference_stmt, convert_local_reference_op, + info, gimple_omp_body_ptr (omp_for_stmt)); + info->suppress_expansion = save_suppress; + } break; case GIMPLE_OMP_SECTIONS: @@ -2416,7 +2424,7 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p, case GIMPLE_OMP_FOR: walk_body (convert_gimple_call, NULL, info, - gimple_omp_for_pre_body_ptr (stmt)); + gimple_omp_for_pre_body_ptr (as_a <gomp_for *> (stmt))); /* FALLTHRU */ case GIMPLE_OMP_SECTIONS: case GIMPLE_OMP_SECTION: -- 1.7.11.7