diff options
author | Owen Anderson <resistor@mac.com> | 2009-01-26 19:12:06 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-01-26 19:12:06 +0000 |
commit | 8af1e761f824ca46088780c2fbe1de9e4278f06c (patch) | |
tree | fe22ad0fcc3fa87c5ffd38308006da9764c1ca86 /lib | |
parent | 5b2e5893c62cac7f349b348400c669d40e2eeca2 (diff) | |
download | external_llvm-8af1e761f824ca46088780c2fbe1de9e4278f06c.zip external_llvm-8af1e761f824ca46088780c2fbe1de9e4278f06c.tar.gz external_llvm-8af1e761f824ca46088780c2fbe1de9e4278f06c.tar.bz2 |
Fix an issue where LiveIntervals was trying to be smart about removing kill
markers, and ended up foiling the interval reconstruction.
This allows us to turn on reconstruction in the pre alloc splitter, which
fixes a number of miscompilations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/PreAllocSplitting.cpp | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp index 16a9e6d..0325f7c 100644 --- a/lib/CodeGen/PreAllocSplitting.cpp +++ b/lib/CodeGen/PreAllocSplitting.cpp @@ -748,12 +748,12 @@ VNInfo* PreAllocSplitting::PerformPHIConstruction( ret = PerformPHIConstruction(walker, MBB, LI, Visited, Defs, Uses, NewVNs, LiveOut, Phis, false, true); + LI->addRange(LiveRange(UseIndex, EndIndex+1, ret)); + // FIXME: Need to set kills properly for inter-block stuff. if (LI->isKill(ret, UseIndex)) LI->removeKill(ret, UseIndex); if (intrablock) LI->addKill(ret, EndIndex); - - LI->addRange(LiveRange(UseIndex, EndIndex+1, ret)); } else if (ContainsDefs && ContainsUses){ SmallPtrSet<MachineInstr*, 2>& BlockDefs = Defs[MBB]; SmallPtrSet<MachineInstr*, 2>& BlockUses = Uses[MBB]; @@ -805,13 +805,13 @@ VNInfo* PreAllocSplitting::PerformPHIConstruction( ret = PerformPHIConstruction(walker, MBB, LI, Visited, Defs, Uses, NewVNs, LiveOut, Phis, false, true); + LI->addRange(LiveRange(StartIndex, EndIndex+1, ret)); + if (foundUse && LI->isKill(ret, StartIndex)) LI->removeKill(ret, StartIndex); if (intrablock) { LI->addKill(ret, EndIndex); } - - LI->addRange(LiveRange(StartIndex, EndIndex+1, ret)); } // Memoize results so we don't have to recompute them. @@ -1131,18 +1131,10 @@ bool PreAllocSplitting::Rematerialize(unsigned vreg, VNInfo* ValNo, TII->reMaterialize(MBB, RestorePt, vreg, DefMI); LIs->InsertMachineInstrInMaps(prior(RestorePt), RestoreIdx); - if (KillPt->getParent() == BarrierMBB) { - VNInfo* After = UpdateRegisterInterval(ValNo, LIs->getUseIndex(KillIdx)+1, - LIs->getDefIndex(RestoreIdx)); - - RenumberValno(After); - - ++NumSplits; - ++NumRemats; - return true; - } - - RepairLiveInterval(CurrLI, ValNo, DefMI, RestoreIdx); + ReconstructLiveInterval(CurrLI); + unsigned RematIdx = LIs->getInstructionIndex(prior(RestorePt)); + RematIdx = LiveIntervals::getDefIndex(RematIdx); + RenumberValno(CurrLI->findDefinedVNInfo(RematIdx)); ++NumSplits; ++NumRemats; @@ -1315,28 +1307,14 @@ bool PreAllocSplitting::SplitRegLiveInterval(LiveInterval *LI) { MachineInstr *LoadMI = prior(RestorePt); LIs->InsertMachineInstrInMaps(LoadMI, RestoreIndex); - // If live interval is spilled in the same block as the barrier, just - // create a hole in the interval. - if (!DefMBB || - (SpillMI && SpillMI->getParent() == BarrierMBB)) { - // Update spill stack slot live interval. - UpdateSpillSlotInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, - LIs->getDefIndex(RestoreIndex)); - - VNInfo* After = UpdateRegisterInterval(ValNo, - LIs->getUseIndex(SpillIndex)+1, - LIs->getDefIndex(RestoreIndex)); - RenumberValno(After); - - ++NumSplits; - return true; - } - // Update spill stack slot live interval. UpdateSpillSlotInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, LIs->getDefIndex(RestoreIndex)); - RepairLiveInterval(CurrLI, ValNo, DefMI, RestoreIndex); + ReconstructLiveInterval(CurrLI); + unsigned RestoreIdx = LIs->getInstructionIndex(prior(RestorePt)); + RestoreIdx = LiveIntervals::getDefIndex(RestoreIdx); + RenumberValno(CurrLI->findDefinedVNInfo(RestoreIdx)); ++NumSplits; return true; |