This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Balance register usage when sinking splats
Needs ReviewPublic

Authored by dmgreen on May 29 2020, 9:12 AM.

Details

Summary

If we sink a splat into a loop in order to make more use of MVE r reg instructions, we can sometimes get to a point where we go over the register limit, leading to more spills in the loop than we helped by not using the q reg. In order to alleviate that this patch attempts to come up with a rough estimate of the number of different registers used in a loop, and doesn't sink if there are free Q regs but no free R regs.

I had to add some LoopInfo update too, in order to prevent the LoopInfo containing stale information.

Diff Detail

Event Timeline

dmgreen created this revision.May 29 2020, 9:12 AM

Trying to make register pressure estimates in CodeGenPrepare seems a little dubious to me; it's hard to measure actual pressure before isel. And we don't want to be scattering ad-hoc pressure estimators across the codebase. And we don't want to redo the computation for each operation in the loop. (Anything obviously O(N^2) makes me worried...)

Probably you'd get better quality results after isel. But I guess working with MachineInstrs is trickier.