This is an archive of the discontinued LLVM Phabricator instance.

LiveRegUnits: Add accumulateBackward() function
ClosedPublic

Authored by MatzeB on Jul 6 2016, 7:21 PM.

Details

Summary

This function can be used to accumulate the set of all read and modified
register in a sequence of instructions.

Use this code in RegisterScavenging.cpp:findSurvivorBackwards() and
AArch64A57FPLoadBalancing::scavengeRegister():

  • The register scavenging code is a bit more efficient since we avoid needless transformation of a register unit live set into a register live set.
  • The behaviour of findSurvivorBackwards() is slightly changed: In case of multiple possibilities the first register in the register class instead of the one with the smallest number is picked.
  • The AArch64A57LoadBalancing code is using a backwards analysis now which is irrespective of kill flags. This is the main motivation for this change.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 63015.Jul 6 2016, 7:21 PM
MatzeB retitled this revision from to LiveRegUnits: Add accumulateBackward() function.
MatzeB updated this object.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
qcolombet accepted this revision.Jul 21 2016, 5:49 PM
qcolombet edited edge metadata.
qcolombet added inline comments.
include/llvm/CodeGen/LiveRegUnits.h
81 ↗(On Diff #63015)

Rename into addRegsNotPreservedByMask.

lib/CodeGen/RegisterScavenging.cpp
358 ↗(On Diff #63015)

\p To

571 ↗(On Diff #63015)

You didn’t like the assert :P.

lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
507 ↗(On Diff #63015)

That would be weird, but, to be safe, shouldn’t we do the test before the call to stepBackward, i.e., if MBB is empty that will crash, right?

This revision is now accepted and ready to land.Jul 21 2016, 5:49 PM

Looks like patch was not committed.

Looks like patch was not committed.

This patch depends on D21916: Add LiveRegUnits class. which was committed but subsequently reverted (phab cannot express that). The situation is not resolved yet.

In the interest of not having this lying around uncommitted for much longer, I am committing this without the RegisterScavenging parts (the RegisterScavenging rewrite this was based on caused build failures).

This revision was automatically updated to reflect the committed changes.