gcc/ * gimple.h (gimple_cond_set_true_label): Require a gimple_cond. (gimple_cond_set_false_label): Likewise.
* tree-cfg.c (make_cond_expr_edges): Convert "entry" from gimple to a gimple_cond. (cleanup_dead_labels): Introduce a checked cast to a gimple_cond within the GIMPLE_COND case. --- gcc/gimple.h | 6 ++---- gcc/tree-cfg.c | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index 15e09db..395c432 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3369,9 +3369,8 @@ gimple_cond_true_label (const_gimple gs) predicate evaluates to true. */ static inline void -gimple_cond_set_true_label (gimple gs, tree label) +gimple_cond_set_true_label (gimple_cond gs, tree label) { - GIMPLE_CHECK (gs, GIMPLE_COND); gimple_set_op (gs, 2, label); } @@ -3380,9 +3379,8 @@ gimple_cond_set_true_label (gimple gs, tree label) predicate evaluates to false. */ static inline void -gimple_cond_set_false_label (gimple gs, tree label) +gimple_cond_set_false_label (gimple_cond gs, tree label) { - GIMPLE_CHECK (gs, GIMPLE_COND); gimple_set_op (gs, 3, label); } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index caa11c1..68093de 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -999,7 +999,7 @@ assign_discriminators (void) static void make_cond_expr_edges (basic_block bb) { - gimple entry = last_stmt (bb); + gimple_cond entry = last_stmt (bb)->as_a_gimple_cond (); gimple then_stmt, else_stmt; basic_block then_bb, else_bb; tree then_label, else_label; @@ -1370,21 +1370,24 @@ cleanup_dead_labels (void) switch (gimple_code (stmt)) { case GIMPLE_COND: - label = gimple_cond_true_label (stmt); - if (label) - { - new_label = main_block_label (label); - if (new_label != label) - gimple_cond_set_true_label (stmt, new_label); - } + { + gimple_cond cond_stmt = stmt->as_a_gimple_cond (); + label = gimple_cond_true_label (cond_stmt); + if (label) + { + new_label = main_block_label (label); + if (new_label != label) + gimple_cond_set_true_label (cond_stmt, new_label); + } - label = gimple_cond_false_label (stmt); - if (label) - { - new_label = main_block_label (label); - if (new_label != label) - gimple_cond_set_false_label (stmt, new_label); - } + label = gimple_cond_false_label (cond_stmt); + if (label) + { + new_label = main_block_label (label); + if (new_label != label) + gimple_cond_set_false_label (cond_stmt, new_label); + } + } break; case GIMPLE_SWITCH: -- 1.8.5.3