From: Frank Ch. Eigler Date: Thu, 23 Sep 2004 15:47:59 +0000 (+0000) Subject: re PR tree-optimization/17533 (cc1plus crashes on libmudflap test case, verify_domina... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df485d8007f540528501f9286531088ae5044420;p=platform%2Fupstream%2Fgcc.git re PR tree-optimization/17533 (cc1plus crashes on libmudflap test case, verify_dominators()) 2004-09-23 Frank Ch. Eigler PR tree-optimization/17533 * dominance.c (verify_dominators): Tolerate even more incorrect dominance data during error message printing. * tree-mudflap.c (mf_build_check_statement_for): Build basic blocks and edges more correctly. From-SVN: r87954 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65f8c94..93ad667 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-23 Frank Ch. Eigler + + PR tree-optimization/17533 + * dominance.c (verify_dominators): Tolerate even more incorrect + dominance data during error message printing. + * tree-mudflap.c (mf_build_check_statement_for): Build basic blocks + and edges more correctly. + 2004-09-23 Dorit Naishlos * tree.def (ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): diff --git a/gcc/dominance.c b/gcc/dominance.c index ef40b54..bbb0b21 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -829,16 +829,17 @@ verify_dominators (enum cdi_direction dir) FOR_EACH_BB (bb) { basic_block dom_bb; + basic_block imm_bb; dom_bb = recount_dominator (dir, bb); - if (dom_bb != get_immediate_dominator (dir, bb)) + imm_bb = get_immediate_dominator (dir, bb); + if (dom_bb != imm_bb) { - if (dom_bb == NULL) - error ("dominator of %d should be (unknown), not %d", - bb->index, get_immediate_dominator(dir, bb)->index); + if ((dom_bb == NULL) || (imm_bb == NULL)) + error ("dominator of %d status unknown", bb->index); else error ("dominator of %d should be %d, not %d", - bb->index, dom_bb->index, get_immediate_dominator(dir, bb)->index); + bb->index, dom_bb->index, imm_bb->index); err = 1; } } diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index d5e278d..138dda8 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -508,25 +508,42 @@ mf_build_check_statement_for (tree addr, tree size, bsi_prev (&bsi); if (! bsi_end_p (bsi)) { + /* We're processing a statement in the middle of the block, so + we need to split the block. This creates a new block and a new + fallthrough edge. */ e = split_block (cond_bb, bsi_stmt (bsi)); cond_bb = e->src; join_bb = e->dest; } else { + /* We're processing the first statement in the block, so we need + to split the incoming edge. This also creates a new block + and a new fallthrough edge. */ join_bb = cond_bb; - cond_bb = create_empty_bb (join_bb->prev_bb); - e = make_edge (cond_bb, join_bb, 0); + cond_bb = split_edge (find_edge (join_bb->prev_bb, join_bb)); } - e->flags = EDGE_FALSE_VALUE; + + /* A recap at this point: join_bb is the basic block at whose head + is the gimple statement for which this check expression is being + built. cond_bb is the new synthetic basic block which will + contain the cache-lookup code, and a conditional that jumps to + the cache-miss code or, much more likely, over to join_bb. */ + + /* Create the bb that contains the cache-miss fallback block (mf_check). */ then_bb = create_empty_bb (cond_bb); make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); - make_edge (then_bb, join_bb, EDGE_FALLTHRU); + make_single_succ_edge (then_bb, join_bb, EDGE_FALLTHRU); /* We expect that the conditional jump we will construct will not be taken very often as it basically is an exception condition. */ predict_edge_def (then_bb->pred, PRED_MUDFLAP, NOT_TAKEN); + /* Mark the pseudo-fallthrough edge from cond_bb to join_bb. */ + e = find_edge (cond_bb, join_bb); + e->flags = EDGE_FALSE_VALUE; + predict_edge_def (e, PRED_MUDFLAP, TAKEN); + /* Update dominance info. Note that bb_join's data was updated by split_block. */ if (dom_computed[CDI_DOMINATORS] >= DOM_CONS_OK)