Issue 147813
Summary `musttail` generates redundant moves on 32-bit platforms
Labels new issue
Assignees
Reporter brandtbucher
    For example, this code:

```cpp
int bar(int);

int
foo_tail(int x)
{
    // Correct, compiles to a single jmp:
    return bar(x);
}

int
foo_musttail(int x)
{
    // Buggy, loads and re-spills all parameters:
    __attribute__((musttail)) return bar(x);
}
```

Compiles to:

```s
_foo_tail:
  jmp _bar

_foo_musttail:
  movl 4(%esp), %eax
  movl %eax, 4(%esp)
  jmp _bar
```

[Compiler Explorer](https://godbolt.org/z/sYoMMjoxY)

Adding more parameters to the function (and tail call) increases the number of redundant loads/spills, too.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to