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

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 10:39:43 PDT 2016


Author: qcolombet
Date: Wed Jun  8 12:39:43 2016
New Revision: 272176

URL: http://llvm.org/viewvc/llvm-project?rev=272176&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp

Modified: llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp?rev=272176&r1=272175&r2=272176&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp Wed Jun  8 12:39:43 2016
@@ -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));




More information about the llvm-commits mailing list