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 | 388f6f51a03249ef8514a577a39c4b9a42075298 (patch) | |
tree | 56ee3896d5763ab406c07c57bb1d423f986ac156 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | 7f09c88977afba2114ea5beb4b7d9aed5256f9c8 (diff) | |
download | bcm5719-llvm-388f6f51a03249ef8514a577a39c4b9a42075298.tar.gz bcm5719-llvm-388f6f51a03249ef8514a577a39c4b9a42075298.zip |
Fix a bug where splitting cause some unnecessary spilling.
llvm-svn: 44482
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index 2b22faf1cc4..77a5505ca83 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/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); + } } } } |