[PATCH] D138532: [SPARC][clang] Enable frame pointer optimization by default

Koakuma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 22 17:28:09 PST 2022


koakuma added a comment.

In D138532#3945422 <https://reviews.llvm.org/D138532#3945422>, @MaskRay wrote:

> I think we usually follow GCC instead of other targets.

GCC enables it by default too, for example see https://godbolt.org/z/brPMKnM17
(That link also has comparison with clang with `-fomit-frame-pointer`/`-fno-omit-frame-pointer`)

> I am unfamiliar with sparc. Can you show an example where `-fomit-frame-pointer`/`-fno-omit-frame-pointer` demonstrate a codegen difference? I tried some simple examples and cannot reproduce a difference.

Unfortunately on SPARC, due to the register window mechanics this optimization can only be done on leaf functions.
As for the concrete effects, it skips the `save` and `restore` instructions for register window management, which, among other things, does the saving/restoring of frame pointers, and changes the return instruction to `retl` (aka `jmp %o7+8`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138532/new/

https://reviews.llvm.org/D138532



More information about the cfe-commits mailing list