https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81611

--- Comment #16 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Even if create_mem_ref_raw created a MEM_REF, we'd still allocate a new pseudo
for the reg - 1 at cfgexpand, and that ends up preventing the post_inc
addressing mode from being selected.

The more I think about it, the more I conclude we have to bite the bullet and
support post_inc addressing modes in auto_inc_dec, even with increments saved
on another pseudo before the memory uses.  Not just for iv uses, but also for
linear code, mainly because the IR we generate for post-inc, all the way from
the beginning, makes it more likely that the increment will be logically before
the use of the old value as an address.  I was trying to avoid that, but at
this point anything else feels like papering over the problem.

A smarter addressing-mode-aware middle end could tentatively generate off-by-1
base addresses so as to enable otherwise invalid addresses and subsequent
post_inc transformations, but...  if the transformation doesn't take place, we
may end up worse off.

Reply via email to