]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/44375 (goto_locus lost at -O0 during cfg cleanup)
authorJakub Jelinek <jakub@redhat.com>
Thu, 3 Jun 2010 12:07:18 +0000 (14:07 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 3 Jun 2010 12:07:18 +0000 (14:07 +0200)
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

gcc/ChangeLog
gcc/tree-cfg.c

index 8e4aed8a338da09f4e1331f351f27f532ac43944..61cf4d76c32da15ed84eabd1d891bf88b5a608b1 100644 (file)
@@ -1,3 +1,10 @@
+2010-06-03  Jakub Jelinek  <jakub@redhat.com>
+
+       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.
+
 2010-06-03  Jan Hubicka  <jh@suse.cz>
            Jakub Jelinek  <jakub@redhat.com>
 
index 7db5192a2ea8d0e7685ee4b3aff0cf8b617dab42..eca3ed018ce7909dfa40fe89248f66b8a8ba4abe 100644 (file)
@@ -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;
 }