On Thu, Feb 10, 2022 at 05:21:07PM +0100, Jakub Jelinek wrote:
> On Thu, Feb 10, 2022 at 10:10:13AM -0600, Segher Boessenkool wrote:
> > But we do have that in other cases, and not just for combine.  IMO it
> > is a good idea to robustify for_each_inc_dec (simply have it skip if the
> > address is not MODE_INT or such).  It also is a good idea to robustify
> > combine subst, just as you do.  It is best to do both!
> 
> Well, skipping would mean the callback isn't called on it so the autoinc
> isn't detected.

Which is fine, because it isn't valid in the first place!  The only
thing we have to do is not ICE, this RTL is not long for this world.

> > So does it not fail if you make this valid code (by using another
> > register)?  bp, si, or di maybe?
> 
> Not on x86, that isn't a general auto-inc-dec target, but uses PRE_DEC
> etc. only for the sp hard register.

Ugh.  Does it have any benefit from using autoinc at all then?  (Actual
benefit, not notational convenience).

> For other targets we'd need to somehow convince all the earlier passes
> (gimple and RTL) not to try to propagate the constant value into the
> addition inside of a memory address.

I wonder if there is any target for which autoinc is more convenient
than inconvenient (other than in inline asm, a whole separate
challenge) :-(


Segher

Reply via email to