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

            Bug ID: 122504
           Summary: [13/14/15/16 Regression] -fno-plt code quality
                    regression on arm64
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*-*

For

void f1(void);
void f2(void);
void f3(void);

int g1()
{
    f1();
    f2();
    f3();
    return 0;
}

void g2()
{
    f1();
    f2();
    f3();
}

gcc-7 -O2 -fpie -fno-plt used to compute address of GOT just once in g1 and
twice in g2, but starting with gcc-8 both functions redundantly recompute
address of GOT before each call ( https://godbolt.org/z/9q491eb15 ).

Looking at RTL, we start with explicit GOT computations in expand (which are
successfully CSE'd), but then they are combined into call instructions, and
after they are split out again nothing CSE's them anymore.

Curious about the history there, why is the backend forming more-abstracted
call patterns in the middle of RTL pipeline?

Reply via email to