diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-12-01 04:42:39 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-12-01 04:42:39 +0000 |
commit | 999f947b64bfe038f63a611f003b6fc6fc673826 (patch) | |
tree | 1bb4f3a5a1c67d47338c0decff54ba17e050c902 | |
parent | b9ba3b077c6efcb5c3a4cad3d59c0a095e111cc7 (diff) | |
download | external_llvm-999f947b64bfe038f63a611f003b6fc6fc673826.zip external_llvm-999f947b64bfe038f63a611f003b6fc6fc673826.tar.gz external_llvm-999f947b64bfe038f63a611f003b6fc6fc673826.tar.bz2 |
Fix a bug where splitting cause some unnecessary spilling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44482 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 2b22faf..77a5505 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -995,9 +995,9 @@ rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit, if (VNI) HasKill = anyKillInMBBAfterIdx(li, VNI, MBB, getDefIndex(index)); } + std::map<unsigned, std::vector<SRInfo> >::iterator SII = + SpillIdxes.find(MBBId); if (!HasKill) { - std::map<unsigned, std::vector<SRInfo> >::iterator SII = - SpillIdxes.find(MBBId); if (SII == SpillIdxes.end()) { std::vector<SRInfo> S; S.push_back(SRInfo(index, NewVReg, true)); @@ -1013,6 +1013,16 @@ rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit, Info.canFold = !HasUse; } SpillMBBs.set(MBBId); + } else if (SII != SpillIdxes.end() && + SII->second.back().vreg == NewVReg && + (int)index > SII->second.back().index) { + // There is an earlier def that's not killed (must be two-address). + // The spill is no longer needed. + SII->second.pop_back(); + if (SII->second.empty()) { + SpillIdxes.erase(MBBId); + SpillMBBs.reset(MBBId); + } } } } |