diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-10-07 20:48:40 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-10-07 20:48:40 +0200 |
commit | 7241571ec8f99caff65f266d3ce395cb0eadb59c (patch) | |
tree | 03f51a3cfb0818209eab45192a2bd9ce8a4fa7c4 /gcc/cfgexpand.c | |
parent | aee857a2f4fbbcf0d3fde1d80c8c40d53b5edab1 (diff) | |
download | gcc-7241571ec8f99caff65f266d3ce395cb0eadb59c.zip gcc-7241571ec8f99caff65f266d3ce395cb0eadb59c.tar.gz gcc-7241571ec8f99caff65f266d3ce395cb0eadb59c.tar.bz2 |
re PR middle-end/29609 (Even with -O0 -g gcc optimizes a goto away and I cannot debug)
PR debug/29609
PR debug/36690
PR debug/37616
* basic-block.h (struct edge_def): Add goto_block field.
* cfglayout.c (fixup_reorder_chain): Ensure that there is at least
one insn with locus corresponding to edge's goto_locus if !optimize.
* profile.c (branch_prob): Copy edge's goto_block.
* cfgrtl.c (force_nonfallthru_and_redirect): Use goto_locus for
emitted jumps.
(cfg_layout_merge_blocks): Emit a nop with edge's goto_locus
locator in between the merged basic blocks if !optimize and needed.
* cfgexpand.c (expand_gimple_cond): Convert goto_block and
goto_locus into RTL locator. For unconditional jump use that
locator for the jump insn.
(expand_gimple_cond): Convert goto_block and goto_locus into
RTL locator for all remaining edges. For unconditional jump
use that locator for the jump insn.
* cfgcleanup.c (try_forward_edges): Avoid the optimization if
there is more than one edge or insn locator along the forwarding
edges and !optimize. If there is just one, set e->goto_locus.
* tree-cfg.c (make_cond_expr_edges, make_goto_expr_edges): Set also
edge's goto_block.
(move_block_to_fn): Adjust edge's goto_block.
* gcc.dg/debug/pr29609-1.c: New test.
* gcc.dg/debug/pr29609-2.c: New test.
* gcc.dg/debug/pr36690-1.c: New test.
* gcc.dg/debug/pr36690-2.c: New test.
* gcc.dg/debug/pr36690-3.c: New test.
* gcc.dg/debug/pr37616.c: New test.
* gcc.dg/debug/dwarf2/pr29609-1.c: New test.
* gcc.dg/debug/dwarf2/pr29609-2.c: New test.
* gcc.dg/debug/dwarf2/pr36690-1.c: New test.
* gcc.dg/debug/dwarf2/pr36690-2.c: New test.
* gcc.dg/debug/dwarf2/pr36690-3.c: New test.
* gcc.dg/debug/dwarf2/pr37616.c: New test.
From-SVN: r140948
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 06111cc..e94fe35 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1666,7 +1666,12 @@ expand_gimple_cond (basic_block bb, gimple stmt) add_reg_br_prob_note (last, true_edge->probability); maybe_dump_rtl_for_gimple_stmt (stmt, last); if (true_edge->goto_locus) - set_curr_insn_source_location (true_edge->goto_locus); + { + set_curr_insn_source_location (true_edge->goto_locus); + set_curr_insn_block (true_edge->goto_block); + true_edge->goto_locus = curr_insn_locator (); + } + true_edge->goto_block = NULL; false_edge->flags |= EDGE_FALLTHRU; ggc_free (pred); return NULL; @@ -1677,7 +1682,12 @@ expand_gimple_cond (basic_block bb, gimple stmt) add_reg_br_prob_note (last, false_edge->probability); maybe_dump_rtl_for_gimple_stmt (stmt, last); if (false_edge->goto_locus) - set_curr_insn_source_location (false_edge->goto_locus); + { + set_curr_insn_source_location (false_edge->goto_locus); + set_curr_insn_block (false_edge->goto_block); + false_edge->goto_locus = curr_insn_locator (); + } + false_edge->goto_block = NULL; true_edge->flags |= EDGE_FALLTHRU; ggc_free (pred); return NULL; @@ -1686,6 +1696,13 @@ expand_gimple_cond (basic_block bb, gimple stmt) jumpif (pred, label_rtx_for_bb (true_edge->dest)); add_reg_br_prob_note (last, true_edge->probability); last = get_last_insn (); + if (false_edge->goto_locus) + { + set_curr_insn_source_location (false_edge->goto_locus); + set_curr_insn_block (false_edge->goto_block); + false_edge->goto_locus = curr_insn_locator (); + } + false_edge->goto_block = NULL; emit_jump (label_rtx_for_bb (false_edge->dest)); BB_END (bb) = last; @@ -1708,9 +1725,6 @@ expand_gimple_cond (basic_block bb, gimple stmt) maybe_dump_rtl_for_gimple_stmt (stmt, last2); - if (false_edge->goto_locus) - set_curr_insn_source_location (false_edge->goto_locus); - ggc_free (pred); return new_bb; } @@ -1962,19 +1976,21 @@ expand_gimple_basic_block (basic_block bb) } } - /* Expand implicit goto. */ + /* Expand implicit goto and convert goto_locus. */ FOR_EACH_EDGE (e, ei, bb->succs) { - if (e->flags & EDGE_FALLTHRU) - break; - } - - if (e && e->dest != bb->next_bb) - { - emit_jump (label_rtx_for_bb (e->dest)); - if (e->goto_locus) - set_curr_insn_source_location (e->goto_locus); - e->flags &= ~EDGE_FALLTHRU; + if (e->goto_locus && e->goto_block) + { + set_curr_insn_source_location (e->goto_locus); + set_curr_insn_block (e->goto_block); + e->goto_locus = curr_insn_locator (); + } + e->goto_block = NULL; + if ((e->flags & EDGE_FALLTHRU) && e->dest != bb->next_bb) + { + emit_jump (label_rtx_for_bb (e->dest)); + e->flags &= ~EDGE_FALLTHRU; + } } do_pending_stack_adjust (); |