This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR rtl-optimization/31391
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, Martin Michlmayr <tbm at cyrius dot com>
- Date: Sat, 31 Mar 2007 01:28:49 +0200
- Subject: [PATCH] Fix PR rtl-optimization/31391
Hi,
If bb_note is also BB_END of a basic block, and we move a deleted label
after the note in try_optimize_cfg, we have to make the new DELETED_LABEL
note the new BB_END.
In a perfect world, we'd just use reorder_insns and it would happen
automagically. Unfortunately, reorder_insns marks b as a BB_DIRTY, which
is kind of silly if all you've done is moving a label. But oh well...
I think I need to audit all uses of reorder_insns_nobb anyway, because
using it should be Verboten if we have a CFG available. But that's for
later.
I'm running this patch on a bootstrap&tester box tonight. I'll commit
it if I hear no objections. It's rather obvious, anyway.
Gr.
Steven
PR rtl-optimization/31391
* cfgcleanup.c (try_optimize_cfg): If a removed label is turned
into a DELETED_LABEL note, and the label is in an empty basic
block, update BB_END as well as BB_HEAD.
Index: cfgcleanup.c
===================================================================
--- cfgcleanup.c (revision 123362)
+++ cfgcleanup.c (working copy)
@@ -2034,6 +2034,8 @@ try_optimize_cfg (int mode)
reorder_insns_nobb (label, label, bb_note);
BB_HEAD (b) = bb_note;
+ if (BB_END (b) == bb_note)
+ BB_END (b) = label;
}
if (dump_file)
fprintf (dump_file, "Deleted label in block %i.\n",