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 for the mainline.


Richard Sandiford <richard@codesourcery.com> writes:

> Notes can be used for more than just insn changes followed by
> calls to recog(), though.  E.g. if anyone ever tries to apply
> a register substitution on a REG_EQUAL note and simplify the
> result, we're likely to ICE.  IMO, the onus ought to be on
> combine to generate valid notes rather than the rtl optimisers
> to be bulletproof against that sort of thing.

I would certainly support that.

However, for the other reasons I noted, I still believe that my patch
is a small positive step forward.  You are correct that it can
theoretically introduce new problems, but my feeling is that it won't.
Of course I'll certainly look at any that arise.

> I'm not trying to pick a fight here.  It's just that this question
> about the validity of REG_EQUAL notes has bugged me for a while,
> and the policy surrounding them has always seemed somewhat fuzzy.
> Some problems have been fixed by not generating invalid notes;
> others have been fixed by making gcc deal more gracefully with
> invalid notes.  I'm just trying to nail down what the policy
> actually is.
> 
> As I see it, your patch stops combine from creating one sort of invalid
> note, but allows it to generate another.  Do you think that's OK
> policy-wise?  Or, to put it another way, do you think we should move
> to a situation where notes are always meaningful?  If so, it might
> make sense to have a policy in which the number of invalid notes
> should monotonically decrease.

I think the only sensible policy is that notes should always be valid
RTL.  And I agree that my patch can introduce invalid notes which were
not present before, and is not ideal for that reason.  But I also
think that using a single pseudo-register in multiple modes, wherever
the references occur, is a bigger problem than invalid notes, so I
think that my patch is, overall, slightly better than the previous
situation.

I'd like to have a fully coherent answer here, but I don't.

It does occur to me that we can avoid the problem in combine by making
an initial pass through the insns and recording every register used in
a register note.  We can then change can_change_dest_mode to forbid
the use of those registers.  Maybe I'll work on that later.  If
somebody implements that, my patch will still be slightly better, and
will definitely not introduce invalid notes which were not present
before.

Ian


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