This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][AArch64] Improve register bank mappings for G_SELECT
ClosedPublic

Authored by paquette on May 22 2019, 1:04 PM.

Details

Summary

The fcsel and csel instructions differ in only the register banks they work on. So, they're entirely interchangeable otherwise.

With this in mind, this does two things:

  • Teach AArch64RegisterBankInfo to consider the inputs to G_SELECT as well as the outputs.
  • Teach it to choose the best register bank mapping based off the constraints of the inputs and outputs.

The "best" in this case means the one that requires the smallest number of copies to properly emit a fcsel/csel.

For example, if the inputs are all already going to be on FPRs, we should emit an fcsel, even if the output is a GPR. This costs one copy to produce the result, but saves us from copying the inputs into GPRs.

This saves some copies in optimized builds.

Diff Detail

Repository
rL LLVM

Event Timeline

paquette created this revision.May 22 2019, 1:04 PM
paquette edited the summary of this revision. (Show Details)May 22 2019, 1:41 PM
This revision is now accepted and ready to land.May 24 2019, 10:58 AM
This revision was automatically updated to reflect the committed changes.