Patchwork Remove dead labels to increase superblock scope

login
register
mail settings
Submitter Tom de Vries
Date Nov. 25, 2011, 1:13 p.m.
Message ID <4ECF9493.5040008@mentor.com>
Download mbox | patch
Permalink /patch/127692/
State New
Headers show

Comments

Tom de Vries - Nov. 25, 2011, 1:13 p.m.
On 25/11/11 14:05, Steven Bosscher wrote:
> On Fri, Nov 25, 2011 at 2:03 PM, Michael Matz <matz@suse.de> wrote:
>> Hi,
>>
>> On Fri, 25 Nov 2011, Tom de Vries wrote:
>>
>>>> Note that you actually can remove labels also if they are
>>>> !can_delete_label_p, if you use delete_insn (which you do).  It will
>>>> replace such undeletable labels by a DELETED_LABEL note.
>>>
>>> I tried that as well but ran into these errors in rtl_verify_flow_info_1:
>>> ...
>>> libquadmath/printf/cmp.c:56:1: error: NOTE_INSN_BASIC_BLOCK is missing for block 6
>>> libquadmath/printf/cmp.c:56:1: error: NOTE_INSN_BASIC_BLOCK 79 in middle of
>>> basic block 6
>>
>> Hmpf, probably bitrotted over time.  Oh well, so be it.
> 
> No, DELETED_LABEL notes still work just fine. It depends on how you
> remove the label and replace it with a note, and Tom isn't showing
> what he did, so...

This is the patch with which I ran into the rtl_verify_flow_info_1 errors:
...
...

Thanks,
- Tom

> 
> Ciao!
> Steven

Patch

Index: gcc/cfglayout.c
===================================================================
--- gcc/cfglayout.c (revision 181172)
+++ gcc/cfglayout.c (working copy)
@@ -857,6 +857,9 @@  fixup_reorder_chain (void)
 				       (e_taken->src, e_taken->dest));
 		  e_taken->flags |= EDGE_FALLTHRU;
 		  update_br_prob_note (bb);
+		  if (LABEL_NUSES (ret_label) == 0
+		      && single_pred_p (e_taken->dest))
+		    delete_insn (ret_label);
 		  continue;
 		}
 	    }