This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Use lrdsb for more thumb1 loads.
ClosedPublic

Authored by dmgreen on Mar 16 2021, 3:49 AM.

Details

Summary

Given a sextload i16, we can usually generate ldrsh [rn. rm]. If we don't naturally have a rn, rm addressing mode, we can either generate ldrh rn, #0; sxth or mov rm, #0; ldrsh [rn. rm].

We currently generate the first, always creating a sxth. They are both the same number of instructions, but If we generate the second then the mov #0 will likely be CSE'd or pulled out of a loop, etc.

This adjusts the ISel patterns to do that, creating a mov instead of a sxth.

Diff Detail

Event Timeline

dmgreen created this revision.Mar 16 2021, 3:49 AM
dmgreen requested review of this revision.Mar 16 2021, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2021, 3:49 AM

Make sense to me, but was just wondering if you haven't seen any regressions? If the constant is hoisted, it could contribute to higher register pressure and spilling?

Yeah as with any change like this, where register allocation is affected, some things will get better and some worse. It's always going to be a bit chaotic like that just because you might spill in a different place, and we only have 8 regs. In general this is an improvement in the testing I ran.

SjoerdMeijer accepted this revision.Mar 16 2021, 5:50 AM

Okay, it's a bit of an indirect way, but fair enough I think.

This revision is now accepted and ready to land.Mar 16 2021, 5:50 AM
This revision was landed with ongoing or failed builds.Mar 17 2021, 8:29 AM
This revision was automatically updated to reflect the committed changes.