| Issue |
107730
|
| Summary |
MIPS tail calls are disabled by default at all optimization levels
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
InBetweenNames
|
Hello, I noticed that tail call optimization is disabled on MIPS at all optimization levels by default. This is causing issues with the `musttail` attribute in C and C++ programs, where tail calls that otherwise would be eligible are not being treated as such.
The relevant flag is defined here:
https://github.com/llvm/llvm-project/blob/98563b19c2d13bac7fb5ee2717ccae6279699e4c/llvm/lib/Target/Mips/MipsSEISelLowering.cpp#L54-L56
When building with `-mllvm -mips-tail-calls=1`, tail calls appear to be optimized accordingly (in the few tests I've done). I noticed that there are test cases for this flag throughout the backend (just search for `mips-tail-calls=1`).
Here are a few issues that are affected by this behaviour:
https://github.com/llvm/llvm-project/issues/47971
https://github.com/llvm/llvm-project/issues/51709
https://github.com/llvm/llvm-project/issues/57795
Is it possible we could make the MIPS backend behave like the others in this respect? It seems to me that if a call site is marked `musttail`, the backend should make every effort towards performing the tail call regardless of the current optimization level. I would be willing to submit a PR for this change if there's interest.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs