[Bug target/93396] New: [RX] tail call optimization does not work with indirect call

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 23 04:42:00 GMT 2020


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

            Bug ID: 93396
           Summary: [RX] tail call optimization does not work with
                    indirect call
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
  Target Milestone: ---

Compiling the following on RX with -O2

[[gnu::noinline]]
int test_1 (int x)
{
  return x + 1;
}

[[gnu::noinline]]
int test_2 (int x)
{
  return test_1 (x);
}

[[gnu::noinline]]
int test_3 (int (*func)(int), int x)
{
  return func (x);
}

results in:

        .global __Z6test_1i
        .type   __Z6test_1i, @function
__Z6test_1i:
        add     #1, r1
        rts
        .size   __Z6test_1i, .-__Z6test_1i
        .global __Z6test_2i
        .type   __Z6test_2i, @function
__Z6test_2i:
        bra     __Z6test_1i
        .size   __Z6test_2i, .-__Z6test_2i
        .global __Z6test_3PFiiEi
        .type   __Z6test_3PFiiEi, @function
__Z6test_3PFiiEi:
        mov.L   r1, r14
        mov.L   r2, r1
        jsr     r14
        rts
        .size   __Z6test_3PFiiEi, .-__Z6test_3PFiiEi

It seems something is missing for the tail call optimization to work.


More information about the Gcc-bugs mailing list