summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocBase.cpp
diff options
context:
space:
mode:
authorWei Mi <wmi@google.com>2016-04-04 16:42:40 +0000
committerWei Mi <wmi@google.com>2016-04-04 16:42:40 +0000
commitffbc9c7f3bd9cdb5696c9bd3e3c0b9b8b7128aaa (patch)
treeb6c0770f6747d21790bfc4151ded1c815bfd8d18 /llvm/lib/CodeGen/RegAllocBase.cpp
parent68374d15370f63a29e33c867088255839c0f92dd (diff)
downloadbcm5719-llvm-ffbc9c7f3bd9cdb5696c9bd3e3c0b9b8b7128aaa.tar.gz
bcm5719-llvm-ffbc9c7f3bd9cdb5696c9bd3e3c0b9b8b7128aaa.zip
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: 265309
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBase.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocBase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBase.cpp b/llvm/lib/CodeGen/RegAllocBase.cpp
index 16ff48e78a7..1130d64689d 100644
--- a/llvm/lib/CodeGen/RegAllocBase.cpp
+++ b/llvm/lib/CodeGen/RegAllocBase.cpp
@@ -153,3 +153,12 @@ void RegAllocBase::allocatePhysRegs() {
}
}
}
+
+void RegAllocBase::postOptimization() {
+ spiller().postOptimization();
+ for (auto DeadInst : DeadRemats) {
+ LIS->RemoveMachineInstrFromMaps(*DeadInst);
+ DeadInst->eraseFromParent();
+ }
+ DeadRemats.clear();
+}
OpenPOWER on IntegriCloud