[PATCH, rtl] Fix PR84878: Segmentation fault in add_cross_iteration_register_deps

Richard Biener rguenther@suse.de
Tue Mar 27 13:32:00 GMT 2018


On Tue, 27 Mar 2018, Peter Bergner wrote:

> On 3/27/18 3:18 AM, Richard Biener wrote:
> > On Mon, 26 Mar 2018, Peter Bergner wrote:
> >>    /* Create inter-loop true dependences and anti dependences.  */
> >>    for (r_use = DF_REF_CHAIN (last_def); r_use != NULL; r_use = r_use->next)
> >>      {
> >> +      /* PR84878: Some definitions of global hard registers may not have
> >> +      any following uses or they may be artificial, so skip them.  */
> >> +      if (DF_REF_INSN_INFO (r_use->ref) == NULL)
> >> +	continue;
> >> +
> > 
> > To me a better check would be DF_REF_IS_ARTIFICIAL (r_use->ref).  But
> > I'm not sure simply ignoring those will be correct?
> 
> I see now I made a massive mistake in nomenclature in calling these
> "artificial" uses.  :-(  What I meant was the forcing of liveness
> for global registers at the exit block similar to what you mentioned
> in your reply.  Sorry about that.
> 
> 
> 
> > In fact artifical refs do have a basic-block, so
> >
> >>        rtx_insn *use_insn = DF_REF_INSN (r_use->ref);
> >>  
> >>        if (BLOCK_FOR_INSN (use_insn) != g->bb)
> > 
> > should use DF_REF_BB (r_use->ref) instead of indirection through
> > DF_REF_INSN.  Still use_insn is used later but then if the
> > artificial ref is in side g->bb we should better give up here?
> > We don't seem to have use_nodes for these "non-insns".
> 
> Maybe the problem is that we have a r_use->ref at all for these
> non-insns?
> 
> 
> > Somebody with more insight on DF should chime in here and tell
> > me what those "artificial" refs are about ...  there's
> > 
> >     /* If this flag is set for an artificial use or def, that ref
> >        logically happens at the top of the block.  If it is not set
> >        for an artificial use or def, that ref logically happens at the
> >        bottom of the block.  This is never set for regular refs.  */
> >     DF_REF_AT_TOP = 1 << 1,
> > 
> > so this is kind-of global regs being live across all BBs?  This sounds
> > a bit stupid to me, but well ... IMHO those refs should be at
> > specific insns like calls.
> > 
> > So maybe, with a big fat comment, it is OK to ignore artificial
> > refs in this loop...
> 
> Yeah, I'd like someone else's opinion too, as I know even less about
> real artificial uses (as opposed to my incorrect mention in my first
> post). :-)

If they only appear in the exit/entry block ignoring them should be safe.

But who knows...

Richard.



More information about the Gcc-patches mailing list