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

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-07-10

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Cedric Bail from comment #3)
> I tried -Os and -O2 with -m2 and -m4. For -m2a, I did also -Os and -O2, but
> I had to specify -mb.

This is because a default sh-elf configuration compiles for little endian, i.e.
the -ml argument is implicit.  SH2A is big-endian only and hence requires the
addition of -mb.


> I wanted to see if the idea of "pivot" register was something that make
> sense and got into a session with claude code to see if that was something
> that could be integrated in the lra algorithm. It identified that the code
> had a spot that was responsible for actually redoing the computation of the
> base address and proposed a fairly small patch that make sense, to me. It
> solve the reproduction case and actually seems to improve the result
> compared to even pre lra. I have very narrow knowledge of gcc code base and
> can't tests for other platforms as this is clearly going to impact, but
> likely help, any platform with displacement constraints.

I'm working on an pass to do general addressing mode selection optimizations.
It's a long story.  See also PR 56590.

So once this is ready, it should be able to clean up memory accesses generated
by LRA afterwards.  Even though the patch is small, perhaps it's better not to
add more weight to LRA.

Reply via email to