This is an archive of the discontinued LLVM Phabricator instance.

[AARCH64] Teach AArch64FrameLowering::getFrameIndexReferencePreferSP really prefer SP.
ClosedPublic

Authored by skatkov on Oct 5 2021, 4:16 AM.

Details

Summary

Make more efforts to use sp even if fp is present in method.

This is used by STATEPOINT instruction.

Diff Detail

Event Timeline

skatkov created this revision.Oct 5 2021, 4:16 AM
skatkov requested review of this revision.Oct 5 2021, 4:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2021, 4:16 AM

I wonder whether there are some idea who else from aarch64 world can be added to review this change?
Any suggestions are very appreciated.

skatkov added inline comments.Nov 15 2021, 7:38 PM
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
3539

Probably I need to check hasStackRealignment as well...

Spent some time educating myself on AArch64 frame lowering. I'm mostly relying on the diagram at the top of AArch64FrameLowering.cpp. Review guidance is about specializing the case where the variable sized regions are empty.

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
3539

You do.

I'd also strongly prefer you specialize this for the case where there is no SVE stack. (e.g !getSVEStackSize()) Support for SVE can be added at a later time if needed, and would need it's own test coverage. I have no clue how to even suggest writing such a test at this time.

Once you specialize, the code here gets a lot simpler.

3540–3547

You should probably use an early return with the inverted condition above. This would reduce nesting in the new code. Once you simplify based on no SVE, it may be more of a wash though...

Matt added a subscriber: Matt.Nov 17 2021, 12:05 PM
skatkov updated this revision to Diff 388105.Nov 17 2021, 9:47 PM

please take a look.

reames accepted this revision.Nov 18 2021, 9:03 AM

LGTM

This revision is now accepted and ready to land.Nov 18 2021, 9:03 AM