aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SimpleRegisterCoalescing.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-03-26 00:07:25 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-03-26 00:07:25 +0000
commit9f689486094303aff800093cf36d95023da02025 (patch)
tree354a47a79dba636c00b88c6f863e7b1d417d8014 /lib/CodeGen/SimpleRegisterCoalescing.cpp
parent1feeadac1baa7c8725dcd8755abfe90d8defb7df (diff)
Try trivial remat before the coalescer gives up on a vr / physreg coalescing for fear of tying up a physical register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SimpleRegisterCoalescing.cpp')
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index f51bedd334..15ca3740b8 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -1664,7 +1664,8 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
if (JoinPInt.ranges.size() > 1000) {
mri_->setRegAllocationHint(JoinVInt.reg, 0, JoinPReg);
++numAborts;
- DEBUG(dbgs() << "\tPhysical register too complicated, abort!\n");
+ DEBUG(dbgs()
+ << "\tPhysical register live interval too complicated, abort!\n");
return false;
}
@@ -1675,6 +1676,11 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
if (Length > Threshold &&
(((float)std::distance(mri_->use_nodbg_begin(JoinVReg),
mri_->use_nodbg_end()) / Length) < Ratio)) {
+ // Before giving up coalescing, if definition of source is defined by
+ // trivial computation, try rematerializing it.
+ if (ReMaterializeTrivialDef(SrcInt, DstReg, DstSubIdx, CopyMI))
+ return true;
+
mri_->setRegAllocationHint(JoinVInt.reg, 0, JoinPReg);
++numAborts;
DEBUG(dbgs() << "\tMay tie down a physical register, abort!\n");