From 9c388755274ce47fa035a469361724c8ff185412 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 7 Oct 2008 18:48:40 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140948 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cfglayout.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gcc/cfglayout.c') diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index b4ca49f4324..be1188d0b61 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -887,6 +887,46 @@ fixup_reorder_chain (void) if (e && !can_fallthru (e->src, e->dest)) force_nonfallthru (e); } + + /* Ensure goto_locus from edges has some instructions with that locus + in RTL. */ + if (!optimize) + FOR_EACH_BB (bb) + { + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->succs) + if (e->goto_locus && !(e->flags & EDGE_ABNORMAL)) + { + basic_block nb; + + if (simplejump_p (BB_END (e->src))) + { + if (INSN_LOCATOR (BB_END (e->src)) == (int) e->goto_locus) + continue; + if (INSN_LOCATOR (BB_END (e->src)) == 0) + { + INSN_LOCATOR (BB_END (e->src)) = e->goto_locus; + continue; + } + } + if (e->dest != EXIT_BLOCK_PTR) + { + insn = BB_HEAD (e->dest); + if (!INSN_P (insn)) + insn = next_insn (insn); + if (insn && INSN_P (insn) + && INSN_LOCATOR (insn) == (int) e->goto_locus) + continue; + } + nb = split_edge (e); + if (!INSN_P (BB_END (nb))) + BB_END (nb) = emit_insn_after_noloc (gen_nop (), BB_END (nb), + nb); + INSN_LOCATOR (BB_END (nb)) = e->goto_locus; + } + } } /* Perform sanity checks on the insn chain. -- cgit v1.2.1