From 1973b3e2541f95c87e4acb7e134362ff306ec9ed Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Mon, 7 Mar 2011 22:42:16 +0000 Subject: [PATCH] Make the UselessRegs argument optional in the LiveRangeEdit constructor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127181 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/InlineSpiller.cpp | 2 +- lib/CodeGen/LiveRangeEdit.cpp | 7 ++++--- lib/CodeGen/LiveRangeEdit.h | 6 +++--- lib/CodeGen/RegAllocGreedy.cpp | 9 +++------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/CodeGen/InlineSpiller.cpp b/lib/CodeGen/InlineSpiller.cpp index 38e6c859026..34ae3ec2f3e 100644 --- a/lib/CodeGen/InlineSpiller.cpp +++ b/lib/CodeGen/InlineSpiller.cpp @@ -333,7 +333,7 @@ void InlineSpiller::insertSpill(LiveInterval &NewLI, void InlineSpiller::spill(LiveInterval *li, SmallVectorImpl &newIntervals, const SmallVectorImpl &spillIs) { - LiveRangeEdit edit(*li, newIntervals, spillIs); + LiveRangeEdit edit(*li, newIntervals, &spillIs); spill(edit); if (VerifySpills) mf_.verify(&pass_, "After inline spill"); diff --git a/lib/CodeGen/LiveRangeEdit.cpp b/lib/CodeGen/LiveRangeEdit.cpp index 3bbda1c2e60..7de1284cb97 100644 --- a/lib/CodeGen/LiveRangeEdit.cpp +++ b/lib/CodeGen/LiveRangeEdit.cpp @@ -75,9 +75,10 @@ bool LiveRangeEdit::allUsesAvailableAt(const MachineInstr *OrigMI, if (MO.isDef()) return false; // We cannot depend on virtual registers in uselessRegs_. - for (unsigned ui = 0, ue = uselessRegs_.size(); ui != ue; ++ui) - if (uselessRegs_[ui]->reg == MO.getReg()) - return false; + if (uselessRegs_) + for (unsigned ui = 0, ue = uselessRegs_->size(); ui != ue; ++ui) + if ((*uselessRegs_)[ui]->reg == MO.getReg()) + return false; LiveInterval &li = lis.getInterval(MO.getReg()); const VNInfo *OVNI = li.getVNInfoAt(OrigIdx); diff --git a/lib/CodeGen/LiveRangeEdit.h b/lib/CodeGen/LiveRangeEdit.h index d5795cde572..95181305600 100644 --- a/lib/CodeGen/LiveRangeEdit.h +++ b/lib/CodeGen/LiveRangeEdit.h @@ -31,7 +31,7 @@ class VirtRegMap; class LiveRangeEdit { LiveInterval &parent_; SmallVectorImpl &newRegs_; - const SmallVectorImpl &uselessRegs_; + const SmallVectorImpl *uselessRegs_; /// firstNew_ - Index of the first register added to newRegs_. const unsigned firstNew_; @@ -66,7 +66,7 @@ public: /// rematerializing values because they are about to be removed. LiveRangeEdit(LiveInterval &parent, SmallVectorImpl &newRegs, - const SmallVectorImpl &uselessRegs) + const SmallVectorImpl *uselessRegs = 0) : parent_(parent), newRegs_(newRegs), uselessRegs_(uselessRegs), firstNew_(newRegs.size()), scannedRemattable_(false) {} @@ -87,7 +87,7 @@ public: /// anyRematerializable - Return true if any parent values may be /// rematerializable. - /// This function must be called before ny rematerialization is attempted. + /// This function must be called before any rematerialization is attempted. bool anyRematerializable(LiveIntervals&, const TargetInstrInfo&, AliasAnalysis*); diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index 642805e08a8..917e64049c6 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -601,8 +601,7 @@ void RAGreedy::splitAroundRegion(LiveInterval &VirtReg, unsigned PhysReg, SmallVector InterferenceRanges; mapGlobalInterference(PhysReg, InterferenceRanges); - SmallVector SpillRegs; - LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); + LiveRangeEdit LREdit(VirtReg, NewVRegs); SE->reset(LREdit); // Create the main cross-block interval. @@ -1130,8 +1129,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order, << '-' << Uses[BestAfter] << ", " << BestDiff << ", " << (BestAfter - BestBefore + 1) << " instrs\n"); - SmallVector SpillRegs; - LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); + LiveRangeEdit LREdit(VirtReg, NewVRegs); SE->reset(LREdit); SE->openIntv(); @@ -1183,8 +1181,7 @@ unsigned RAGreedy::trySplit(LiveInterval &VirtReg, AllocationOrder &Order, if (Stage < RS_Block) { SplitAnalysis::BlockPtrSet Blocks; if (SA->getMultiUseBlocks(Blocks)) { - SmallVector SpillRegs; - LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); + LiveRangeEdit LREdit(VirtReg, NewVRegs); SE->reset(LREdit); SE->splitSingleBlocks(Blocks); setStage(NewVRegs.begin(), NewVRegs.end(), RS_Block);