summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocBase.h
diff options
context:
space:
mode:
authorWei Mi <wmi@google.com>2016-04-06 15:41:07 +0000
committerWei Mi <wmi@google.com>2016-04-06 15:41:07 +0000
commit18293bef4e4efaafff57da67cef87ea47dc26cae (patch)
tree979c8be87f939b1a7c5c65feeb71ed537bb3424c /llvm/lib/CodeGen/RegAllocBase.h
parent506f295a109918ae7449688e5d6eb0c024f895d0 (diff)
downloadbcm5719-llvm-18293bef4e4efaafff57da67cef87ea47dc26cae.tar.gz
bcm5719-llvm-18293bef4e4efaafff57da67cef87ea47dc26cae.zip
Recommit r265309 after fixed an invalid memory reference bug happened
when DenseMap growed and moved memory. I verified it fixed the bootstrap problem on x86_64-linux-gnu but I cannot verify whether it fixes the bootstrap error on clang-ppc64be-linux. I will watch the build-bot result closely. Replace analyzeSiblingValues with new algorithm to fix its compile time issue. The patch is to solve PR17409 and its duplicates. analyzeSiblingValues is a N x N complexity algorithm where N is the number of siblings generated by reg splitting. Although it causes siginificant compile time issue when N is large, it is also important for performance since it removes redundent spills and enables rematerialization. To solve the compile time issue, the patch removes analyzeSiblingValues and replaces it with lower cost alternatives containing two parts. The first part creates a new spill hoisting method in postOptimization of register allocation. It does spill hoisting at once after all the spills are generated instead of inside every instance of selectOrSplit. The second part queries the define expr of the original register for rematerializaiton and keep it always available during register allocation even if it is already dead. It deletes those dead instructions only in postOptimization. With the two parts in the patch, it can remove analyzeSiblingValues without sacrificing performance. Differential Revision: http://reviews.llvm.org/D15302 llvm-svn: 265547
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBase.h')
-rw-r--r--llvm/lib/CodeGen/RegAllocBase.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBase.h b/llvm/lib/CodeGen/RegAllocBase.h
index 659b8f505a2..296ffe8692c 100644
--- a/llvm/lib/CodeGen/RegAllocBase.h
+++ b/llvm/lib/CodeGen/RegAllocBase.h
@@ -65,6 +65,12 @@ protected:
LiveRegMatrix *Matrix;
RegisterClassInfo RegClassInfo;
+ /// Inst which is a def of an original reg and whose defs are already all
+ /// dead after remat is saved in DeadRemats. The deletion of such inst is
+ /// postponed till all the allocations are done, so its remat expr is
+ /// always available for the remat of all the siblings of the original reg.
+ SmallPtrSet<MachineInstr *, 32> DeadRemats;
+
RegAllocBase()
: TRI(nullptr), MRI(nullptr), VRM(nullptr), LIS(nullptr), Matrix(nullptr) {}
@@ -77,6 +83,10 @@ protected:
// physical register assignments.
void allocatePhysRegs();
+ // Include spiller post optimization and removing dead defs left because of
+ // rematerialization.
+ virtual void postOptimization();
+
// Get a temporary reference to a Spiller instance.
virtual Spiller &spiller() = 0;
OpenPOWER on IntegriCloud