This is an archive of the discontinued LLVM Phabricator instance.

[ARM][MachineOutliner] Add LR RegSave mode.
ClosedPublic

Authored by yroux on May 18 2020, 8:12 AM.

Details

Summary

Outline chunks of code which need to save and restore the link register when a spare register can be used to it.

Diff Detail

Event Timeline

yroux created this revision.May 18 2020, 8:12 AM
samparker added inline comments.May 19 2020, 6:56 AM
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
5653

Is PC already covered by getReservedRegs or do we need to check here too? Also do you mean tGPR? That seems too restrictive for Thumb2. I think it would be better, easier and safer to just use the rGPR for both.

yroux added inline comments.Jun 9 2020, 2:36 AM
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
5653

Yes PC is marked as reserved by getReservedRegs, but you're right rGPR is a much better choice

yroux updated this revision to Diff 269460.Jun 9 2020, 2:38 AM

Change register class to rGPR for both modes and updated testcase

samparker accepted this revision.Jun 11 2020, 5:31 AM

I just run some numbers on the test suite and the results are already looking very good with 1.4% geomean reduction for T32, so many thanks! Is this the final patch of the set?

This revision is now accepted and ready to land.Jun 11 2020, 5:31 AM
yroux added a comment.Jun 11 2020, 7:07 AM

Thanks :)

No there is 3 more patches in the set, one for the default mode (save/restore of lr on the stack), one which will add the support of calls in the outlined regions and the most tricky one which will fixup the stack to handle load/store. In the end we should reach ~3% of size reduction in T32 and ~5% in ARM (this is what I observed on average for various benchs).

So, I'll submit the next 2 patches in the coming days and the last one might take a bit longer to be reabased and validated, but will be out soon.

Thanks for the reviews!

Great stuff, I look forward to the other patches then :)

This revision was automatically updated to reflect the committed changes.