tree tracked_var = target_for_debug_bind (sym);
if (tracked_var)
{
- gimple *note = gimple_build_debug_bind (tracked_var, def, stmt);
- /* If stmt ends the bb, insert the debug stmt on the single
- non-EH edge from the stmt. */
+ /* If stmt ends the bb, insert the debug stmt on the non-EH
+ edge(s) from the stmt. */
if (gsi_one_before_end_p (gsi) && stmt_ends_bb_p (stmt))
{
basic_block bb = gsi_bb (gsi);
FOR_EACH_EDGE (e, ei, bb->succs)
if (!(e->flags & EDGE_EH))
{
- gcc_checking_assert (!ef);
+ /* asm goto can have multiple non-EH edges from the
+ stmt. Insert on all of them where it is
+ possible. */
+ gcc_checking_assert (!ef || (gimple_code (stmt)
+ == GIMPLE_ASM));
ef = e;
+ /* If there are other predecessors to ef->dest, then
+ there must be PHI nodes for the modified
+ variable, and therefore there will be debug bind
+ stmts after the PHI nodes. The debug bind notes
+ we'd insert would force the creation of a new
+ block (diverging codegen) and be redundant with
+ the post-PHI bind stmts, so don't add them.
+
+ As for the exit edge, there wouldn't be redundant
+ bind stmts, but there wouldn't be a PC to bind
+ them to either, so avoid diverging the CFG. */
+ if (e
+ && single_pred_p (e->dest)
+ && gimple_seq_empty_p (phi_nodes (e->dest))
+ && e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
+ {
+ /* If there were PHI nodes in the node, we'd
+ have to make sure the value we're binding
+ doesn't need rewriting. But there shouldn't
+ be PHI nodes in a single-predecessor block,
+ so we just add the note. */
+ gimple *note
+ = gimple_build_debug_bind (tracked_var, def,
+ stmt);
+ gsi_insert_on_edge_immediate (ef, note);
+ }
}
- /* If there are other predecessors to ef->dest, then
- there must be PHI nodes for the modified
- variable, and therefore there will be debug bind
- stmts after the PHI nodes. The debug bind notes
- we'd insert would force the creation of a new
- block (diverging codegen) and be redundant with
- the post-PHI bind stmts, so don't add them.
-
- As for the exit edge, there wouldn't be redundant
- bind stmts, but there wouldn't be a PC to bind
- them to either, so avoid diverging the CFG. */
- if (ef && single_pred_p (ef->dest)
- && ef->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
- {
- /* If there were PHI nodes in the node, we'd
- have to make sure the value we're binding
- doesn't need rewriting. But there shouldn't
- be PHI nodes in a single-predecessor block,
- so we just add the note. */
- gsi_insert_on_edge_immediate (ef, note);
- }
}
else
- gsi_insert_after (&gsi, note, GSI_SAME_STMT);
+ {
+ gimple *note
+ = gimple_build_debug_bind (tracked_var, def, stmt);
+ gsi_insert_after (&gsi, note, GSI_SAME_STMT);
+ }
}
}