This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Improve generation of thumb stack accesses
ClosedPublic

Authored by john.brawn on Aug 2 2023, 4:09 AM.

Details

Summary

Currently when a stack access is out of range of an sp-relative ldr or str then we jump straight to generating the offset with a literal pool load or mov32 pseudo-instruction. This patch improves that in two ways:

  • If the offset is within range of sp-relative add plus an ldr then use that.
  • When we use the mov32 pseudo-instruction, if putting part of the offset into the ldr will simplify the expansion of the mov32 then do so.

Diff Detail

Event Timeline

john.brawn created this revision.Aug 2 2023, 4:09 AM
john.brawn requested review of this revision.Aug 2 2023, 4:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 4:09 AM
stuij added a comment.Aug 7 2023, 8:09 AM

Nice :) and LGTM. Thanks!

stuij accepted this revision.Aug 7 2023, 8:10 AM
This revision is now accepted and ready to land.Aug 7 2023, 8:10 AM
This revision was landed with ongoing or failed builds.Aug 7 2023, 9:55 AM
This revision was automatically updated to reflect the committed changes.