-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AVR] Optimize 'call' to 'rcall' for short programs #54508
Comments
We need to investigate this can be done by linker relaxation. |
What's more, we can check if other relax optimization can be done in lld for AVR. |
apparently avr-gcc doesn't do this optimization Link with Also if you are relaxing, the assembler must not relax by itself, and all relaxations must be postponed until link. |
Sure. Thanks. |
It seems impossible to do this |
What's the problem? All that has to be done is to pass |
Sure. It is my mistake. clang's AVR driver does not handle |
@llvm/issue-subscribers-clang-driver |
This is in accordance with avr-gcc, even '-mno-relax' is specified to avr-gcc, this flag will also be added to the output relocatables. With this flag set, the GNU ld will perform long call -> short call optimization for AVR, otherwise not. Fixes #54508 Reviewed By: MaskRay, jacquesguan, aykevl Differential Revision: https://reviews.llvm.org/D144617
Reviewed By: MaskRay, aykevl Fixes llvm/llvm-project#54508 Differential Revision: https://reviews.llvm.org/D144620
This is in accordance with avr-gcc, even '-mno-relax' is specified to avr-gcc, this flag will also be added to the output relocatables. With this flag set, the GNU ld will perform long call -> short call optimization for AVR, otherwise not. Fixes llvm/llvm-project#54508 Reviewed By: MaskRay, jacquesguan, aykevl Differential Revision: https://reviews.llvm.org/D144617
As a possible optimization, we could look into using rcall instead of call instructions when the target is close enough. For example, here: https://godbolt.org/z/rEz9j71dq (apparently avr-gcc doesn't do this optimization).
If -ffunction-sections is not used, rcall is both shorter in code size and faster in execution speed.
The text was updated successfully, but these errors were encountered: