This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [patch] Clear bb field for insns outside of basic blocks


> > --- 651,666 ----
> >   	{
> >   	  fallthru = split_block (bb, PREV_INSN (insn));
> >   	  if (flow_transfer_insn)
> > ! 	    {
> > ! 	      BB_END (bb) = flow_transfer_insn;
> > !
> > ! 	      /* Clean up the bb field for the insns between the blocks.  */
> > ! 	      for (x = NEXT_INSN (flow_transfer_insn);
> > ! 		   x != BB_HEAD (fallthru->dest);
> > ! 		   x = NEXT_INSN (x))
> > ! 		if (!BARRIER_P (x))
> > ! 		  set_block_for_insn (x, NULL);
> > ! 	    }
> 
> The loop looks overkill.  Don't you just have to check the following?

there might be more than one insn between the basic blocks.

>   if (NEXT_INSN (flow_transfer_insn) != BB_HEAD (fallthru->dest))
> 
> > *************** find_bb_boundaries (basic_block bb)
> > *** 666,671 ****
> > --- 675,688 ----
> >   	{
> >   	  fallthru = split_block (bb, PREV_INSN (insn));
> >   	  BB_END (bb) = flow_transfer_insn;
> > +
> > + 	  /* Clean up the bb field for the insns between the blocks.  */
> > + 	  for (x = NEXT_INSN (flow_transfer_insn);
> > + 	       x != BB_HEAD (fallthru->dest);
> > + 	       x = NEXT_INSN (x))
> > + 	    if (!BARRIER_P (x))
> > + 	      set_block_for_insn (x, NULL);
> > +
> >   	  bb = fallthru->dest;
> >   	  remove_edge (fallthru);
> >   	  flow_transfer_insn = NULL_RTX;
> 
> Likewise.

Ditto.

> > +   for (x = last_head; x != NULL_RTX; x = PREV_INSN (x))
> > +     {
> > +       /* Check that the code before the first basic block has NULL
> > + 	 bb field.  */
> > +       if (!BARRIER_P (x)
> > + 	  && BLOCK_FOR_INSN (x) != NULL)
> > + 	{
> > + 	  error ("insn %d outside of basic blocks has non-NULL bb field",
> > + 		 INSN_UID (x));
> > + 	  err = 1;
> > + 	}
> > +     }
> >     free (bb_info);
> 
> Any particular reason for testing !BARRIER_P everywhere?

You cannot use set_block_for_insn for barriers, as they do not have this
field.

Zdenek


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