This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR rtl-optimization/31391


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

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.



	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",

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]