aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-06-17 20:11:16 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-06-17 20:11:16 +0000
commitf4bacb4eb239be6a6ea7ffa127b92a000fee24cb (patch)
treeecec5253a3a9ada334777c73e8442c83c2010e9b
parentfef64ebeba6d5eb8356c198097f1db79587aa0b9 (diff)
downloadexternal_llvm-f4bacb4eb239be6a6ea7ffa127b92a000fee24cb.zip
external_llvm-f4bacb4eb239be6a6ea7ffa127b92a000fee24cb.tar.gz
external_llvm-f4bacb4eb239be6a6ea7ffa127b92a000fee24cb.tar.bz2
When extending a liveinterval by commuting, don't throw away the live ranges that are not affected.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52430 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index 5cd6dd9..f9a2652 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -381,10 +381,21 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
// simply extend BLR if CopyMI doesn't end the range.
DOUT << "\nExtending: "; IntB.print(DOUT, tri_);
- IntB.removeValNo(BValNo);
+ // Remove val#'s defined by copies that will be coalesced away.
for (unsigned i = 0, e = BDeadValNos.size(); i != e; ++i)
IntB.removeValNo(BDeadValNos[i]);
- VNInfo *ValNo = IntB.getNextValue(AValNo->def, 0, li_->getVNInfoAllocator());
+
+ // Extend BValNo by merging in IntA live ranges of AValNo. Val# definition
+ // is updated. Kills are also updated.
+ VNInfo *ValNo = BValNo;
+ ValNo->def = AValNo->def;
+ ValNo->copy = NULL;
+ for (unsigned j = 0, ee = ValNo->kills.size(); j != ee; ++j) {
+ unsigned Kill = ValNo->kills[j];
+ if (Kill != BLR->end)
+ BKills.push_back(Kill);
+ }
+ ValNo->kills.clear();
for (LiveInterval::iterator AI = IntA.begin(), AE = IntA.end();
AI != AE; ++AI) {
if (AI->valno != AValNo) continue;