Page MenuHomePhabricator

[ARM] Revert low overhead loops with calls before registry allocation.

Authored by dmgreen on Nov 11 2020, 9:01 AM.



This adds code to revert low overhead loops with calls in them before register allocation. Ideally we would not create low overhead loops with calls in them to begin with, but that can be difficult to always get correct. If we want to try and glue together t2LoopDec and t2LoopEnd into a single instruction, we need to ensure that no instructions use LR in the loop. (Technically the final code can be better too, as it doesn't need to use the same registers but that has not been optimized for here, as reverting loops with calls is expected to be very rare).

It also adds a MVETailPredUtils.h header to share the revert code between different passes, and provides a place to expand upon, with RevertLoopWithCall becoming a place to perform other low overhead loop alterations like removing copies or combining LoopDec and End into a single instruction.

Diff Detail

Event Timeline

dmgreen created this revision.Nov 11 2020, 9:01 AM
SjoerdMeijer added inline comments.Nov 11 2020, 9:14 AM
162 ↗(On Diff #304495)


174 ↗(On Diff #304495)

Typo: is -> in

701 ↗(On Diff #304495)

Do we need to run ConvertTailPredLoop if we have reverted above?

dmgreen added inline comments.Nov 12 2020, 2:18 AM
162 ↗(On Diff #304495)

Ah, yeah. This gets renames to that in a later patch. This function is essentially the "Merge LoopDec and LoopEnd" function, that needs to do these things too. I was trying to get things out of the way before that.

701 ↗(On Diff #304495)

Yeah, that should already be handled by it not finding loop components. The RevertLoopWithCall will become MergeLoopEnd in later patches, the return value of which is "has the code been modified", not "has the loop been reverted".

dmgreen updated this revision to Diff 304759.Nov 12 2020, 2:21 AM
This revision is now accepted and ready to land.Dec 7 2020, 3:36 AM