summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-06-08 17:39:43 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-06-08 17:39:43 +0000
commitd6886bd22cdc2f62b5dfee9db46b895b1463de8e (patch)
treec0e8c518c04a333bfceb78f4a6d9fe893df644eb
parentc45e51c891007105036a040c820449a32d419abc (diff)
downloadbcm5719-llvm-d6886bd22cdc2f62b5dfee9db46b895b1463de8e.tar.gz
bcm5719-llvm-d6886bd22cdc2f62b5dfee9db46b895b1463de8e.zip
[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
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
index 5d5a5689d0e..79b78abe95a 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
@@ -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));
OpenPOWER on IntegriCloud