summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/CodeGen/LiveRangeEdit.h8
-rw-r--r--llvm/lib/CodeGen/LiveRangeEdit.cpp26
2 files changed, 18 insertions, 16 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveRangeEdit.h b/llvm/include/llvm/CodeGen/LiveRangeEdit.h
index 84bccde0caa..84ca51e3d72 100644
--- a/llvm/include/llvm/CodeGen/LiveRangeEdit.h
+++ b/llvm/include/llvm/CodeGen/LiveRangeEdit.h
@@ -121,6 +121,9 @@ private:
/// main live range of \p LI or in one of the matching subregister ranges.
bool useIsKill(const LiveInterval &LI, const MachineOperand &MO) const;
+ /// Create a new empty interval based on OldReg.
+ LiveInterval &createEmptyIntervalFrom(unsigned OldReg, bool createSubRanges);
+
public:
/// Create a LiveRangeEdit for breaking down parent into smaller pieces.
/// @param parent The register being spilled or split.
@@ -174,16 +177,13 @@ public:
return makeArrayRef(NewRegs).slice(FirstNew);
}
- /// createEmptyIntervalFrom - Create a new empty interval based on OldReg.
- LiveInterval &createEmptyIntervalFrom(unsigned OldReg);
-
/// createFrom - Create a new virtual register based on OldReg.
unsigned createFrom(unsigned OldReg);
/// create - Create a new register with the same class and original slot as
/// parent.
LiveInterval &createEmptyInterval() {
- return createEmptyIntervalFrom(getReg());
+ return createEmptyIntervalFrom(getReg(), true);
}
unsigned create() { return createFrom(getReg()); }
diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index 86cfbd87f5b..d00b3607867 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -31,21 +31,24 @@ STATISTIC(NumFracRanges, "Number of live ranges fractured by DCE");
void LiveRangeEdit::Delegate::anchor() { }
-LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(unsigned OldReg) {
+LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(unsigned OldReg,
+ bool createSubRanges) {
unsigned VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
- if (VRM) {
+ if (VRM)
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
- }
+
LiveInterval &LI = LIS.createEmptyInterval(VReg);
if (Parent && !Parent->isSpillable())
LI.markNotSpillable();
- // Create empty subranges if the OldReg's interval has them. Do not create
- // the main range here---it will be constructed later after the subranges
- // have been finalized.
- LiveInterval &OldLI = LIS.getInterval(OldReg);
- VNInfo::Allocator &Alloc = LIS.getVNInfoAllocator();
- for (LiveInterval::SubRange &S : OldLI.subranges())
- LI.createSubRange(Alloc, S.LaneMask);
+ if (createSubRanges) {
+ // Create empty subranges if the OldReg's interval has them. Do not create
+ // the main range here---it will be constructed later after the subranges
+ // have been finalized.
+ LiveInterval &OldLI = LIS.getInterval(OldReg);
+ VNInfo::Allocator &Alloc = LIS.getVNInfoAllocator();
+ for (LiveInterval::SubRange &S : OldLI.subranges())
+ LI.createSubRange(Alloc, S.LaneMask);
+ }
return LI;
}
@@ -357,8 +360,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
// LiveRangeEdit::DeadRemats and will be deleted after all the
// allocations of the func are done.
if (isOrigDef && DeadRemats && TII.isTriviallyReMaterializable(*MI, AA)) {
- LiveInterval &NewLI = createEmptyIntervalFrom(Dest);
- NewLI.removeEmptySubRanges();
+ LiveInterval &NewLI = createEmptyIntervalFrom(Dest, false);
VNInfo *VNI = NewLI.getNextValue(Idx, LIS.getVNInfoAllocator());
NewLI.addSegment(LiveInterval::Segment(Idx, Idx.getDeadSlot(), VNI));
pop_back();
OpenPOWER on IntegriCloud