diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-06-03 14:07:18 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-06-03 14:07:18 +0200 |
commit | c87d6057c5c6adf960152985da6fdb43335e3425 (patch) | |
tree | 5d1c3d235bcff20ac849a7ae612d193a9478c613 /gcc/tree-cfg.c | |
parent | e2cc34833f35bfcdcac58d0b348900636f54c6f1 (diff) | |
download | gcc-c87d6057c5c6adf960152985da6fdb43335e3425.zip gcc-c87d6057c5c6adf960152985da6fdb43335e3425.tar.gz gcc-c87d6057c5c6adf960152985da6fdb43335e3425.tar.bz2 |
re PR debug/44375 (goto_locus lost at -O0 during cfg cleanup)
PR debug/44375
* tree-cfg.c (gimple_can_merge_blocks_p): For -O0
return false if merging the bbs would lead to goto_locus
location being lost from the IL.
From-SVN: r160219
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 7db5192..eca3ed0 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1475,6 +1475,23 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b) && name_mappings_registered_p ()) return false; + /* When not optimizing, don't merge if we'd lose goto_locus. */ + if (!optimize + && single_succ_edge (a)->goto_locus != UNKNOWN_LOCATION) + { + location_t goto_locus = single_succ_edge (a)->goto_locus; + gimple_stmt_iterator prev, next; + prev = gsi_last_nondebug_bb (a); + next = gsi_after_labels (b); + if (!gsi_end_p (next) && is_gimple_debug (gsi_stmt (next))) + gsi_next_nondebug (&next); + if ((gsi_end_p (prev) + || gimple_location (gsi_stmt (prev)) != goto_locus) + && (gsi_end_p (next) + || gimple_location (gsi_stmt (next)) != goto_locus)) + return false; + } + return true; } |