[RegBankSelect] Comment on how we could improve repairing with copies.

When repairing with a copy, instead of accounting for the cost of that
copy and actually inserting it, we may be able to use an alternative
source for the register to repair and just use it.

Make sure this is documented, so that we consider that opportunity at
some point.

llvm-svn: 272176
This commit is contained in:
Quentin Colombet 2016-06-08 17:39:43 +00:00
parent c45e51c891
commit d6886bd22c
1 changed files with 11 additions and 0 deletions

View File

@ -178,6 +178,17 @@ uint64_t RegBankSelect::getRepairCost(
// the repairing.
if (MO.isDef())
std::swap(CurRegBank, DesiredRegBrank);
// TODO: It may be possible to actually avoid the copy.
// If we repair something where the source is defined by a copy
// and the source of that copy is on the right bank, we can reuse
// it for free.
// E.g.,
// RegToRepair<BankA> = copy AlternativeSrc<BankB>
// = op RegToRepair<BankA>
// We can simply propagate AlternativeSrc instead of copying RegToRepair
// into a new virtual register.
// We would also need to propagate this information in the
// repairing placement.
unsigned Cost =
RBI->copyCost(*DesiredRegBrank, *CurRegBank,
RegisterBankInfo::getSizeInBits(MO.getReg(), *MRI, *TRI));