forked from OSchip/llvm-project
[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:
parent
c45e51c891
commit
d6886bd22c
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue