forked from OSchip/llvm-project
Avoid being influenced by the presence of dbg_value instructions.
llvm-svn: 99879
This commit is contained in:
parent
09f8cc8c70
commit
cbcccce420
|
|
@ -819,8 +819,9 @@ bool LiveIntervals::isReMaterializable(const LiveInterval &li,
|
||||||
unsigned ImpUse = getReMatImplicitUse(li, MI);
|
unsigned ImpUse = getReMatImplicitUse(li, MI);
|
||||||
if (ImpUse) {
|
if (ImpUse) {
|
||||||
const LiveInterval &ImpLi = getInterval(ImpUse);
|
const LiveInterval &ImpLi = getInterval(ImpUse);
|
||||||
for (MachineRegisterInfo::use_iterator ri = mri_->use_begin(li.reg),
|
for (MachineRegisterInfo::use_nodbg_iterator
|
||||||
re = mri_->use_end(); ri != re; ++ri) {
|
ri = mri_->use_nodbg_begin(li.reg), re = mri_->use_nodbg_end();
|
||||||
|
ri != re; ++ri) {
|
||||||
MachineInstr *UseMI = &*ri;
|
MachineInstr *UseMI = &*ri;
|
||||||
SlotIndex UseIdx = getInstructionIndex(UseMI);
|
SlotIndex UseIdx = getInstructionIndex(UseMI);
|
||||||
if (li.FindLiveRangeContaining(UseIdx)->valno != ValNo)
|
if (li.FindLiveRangeContaining(UseIdx)->valno != ValNo)
|
||||||
|
|
@ -1052,7 +1053,7 @@ rewriteInstructionForSpills(const LiveInterval &li, const VNInfo *VNI,
|
||||||
// all of its uses are rematerialized, simply delete it.
|
// all of its uses are rematerialized, simply delete it.
|
||||||
if (MI == ReMatOrigDefMI && CanDelete) {
|
if (MI == ReMatOrigDefMI && CanDelete) {
|
||||||
DEBUG(dbgs() << "\t\t\t\tErasing re-materializable def: "
|
DEBUG(dbgs() << "\t\t\t\tErasing re-materializable def: "
|
||||||
<< MI << '\n');
|
<< *MI << '\n');
|
||||||
RemoveMachineInstrFromMaps(MI);
|
RemoveMachineInstrFromMaps(MI);
|
||||||
vrm.RemoveMachineInstrFromMaps(MI);
|
vrm.RemoveMachineInstrFromMaps(MI);
|
||||||
MI->eraseFromParent();
|
MI->eraseFromParent();
|
||||||
|
|
@ -1520,6 +1521,12 @@ LiveIntervals::handleSpilledImpDefs(const LiveInterval &li, VirtRegMap &vrm,
|
||||||
MachineOperand &O = ri.getOperand();
|
MachineOperand &O = ri.getOperand();
|
||||||
MachineInstr *MI = &*ri;
|
MachineInstr *MI = &*ri;
|
||||||
++ri;
|
++ri;
|
||||||
|
if (MI->isDebugValue()) {
|
||||||
|
// Remove debug info for now.
|
||||||
|
O.setReg(0U);
|
||||||
|
DEBUG(dbgs() << "Removing debug info due to spill:" << "\t" << *MI);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (O.isDef()) {
|
if (O.isDef()) {
|
||||||
assert(MI->isImplicitDef() &&
|
assert(MI->isImplicitDef() &&
|
||||||
"Register def was not rewritten?");
|
"Register def was not rewritten?");
|
||||||
|
|
@ -2012,6 +2019,8 @@ unsigned LiveIntervals::getNumConflictsWithPhysReg(const LiveInterval &li,
|
||||||
E = mri_->reg_end(); I != E; ++I) {
|
E = mri_->reg_end(); I != E; ++I) {
|
||||||
MachineOperand &O = I.getOperand();
|
MachineOperand &O = I.getOperand();
|
||||||
MachineInstr *MI = O.getParent();
|
MachineInstr *MI = O.getParent();
|
||||||
|
if (MI->isDebugValue())
|
||||||
|
continue;
|
||||||
SlotIndex Index = getInstructionIndex(MI);
|
SlotIndex Index = getInstructionIndex(MI);
|
||||||
if (pli.liveAt(Index))
|
if (pli.liveAt(Index))
|
||||||
++NumConflicts;
|
++NumConflicts;
|
||||||
|
|
@ -2052,7 +2061,7 @@ bool LiveIntervals::spillPhysRegAroundRegDefsUses(const LiveInterval &li,
|
||||||
E = mri_->reg_end(); I != E; ++I) {
|
E = mri_->reg_end(); I != E; ++I) {
|
||||||
MachineOperand &O = I.getOperand();
|
MachineOperand &O = I.getOperand();
|
||||||
MachineInstr *MI = O.getParent();
|
MachineInstr *MI = O.getParent();
|
||||||
if (SeenMIs.count(MI))
|
if (MI->isDebugValue() || SeenMIs.count(MI))
|
||||||
continue;
|
continue;
|
||||||
SeenMIs.insert(MI);
|
SeenMIs.insert(MI);
|
||||||
SlotIndex Index = getInstructionIndex(MI);
|
SlotIndex Index = getInstructionIndex(MI);
|
||||||
|
|
|
||||||
|
|
@ -990,10 +990,17 @@ static unsigned FindFreeRegister(MachineBasicBlock::iterator MII,
|
||||||
SmallVector<unsigned, 4> Kills;
|
SmallVector<unsigned, 4> Kills;
|
||||||
|
|
||||||
// Take a look at 2 instructions at most.
|
// Take a look at 2 instructions at most.
|
||||||
for (unsigned Count = 0; Count < 2; ++Count) {
|
unsigned Count = 0;
|
||||||
|
while (Count < 2) {
|
||||||
if (MII == MBB.begin())
|
if (MII == MBB.begin())
|
||||||
break;
|
break;
|
||||||
MachineInstr *PrevMI = prior(MII);
|
MachineInstr *PrevMI = prior(MII);
|
||||||
|
MII = PrevMI;
|
||||||
|
|
||||||
|
if (PrevMI->isDebugValue())
|
||||||
|
continue; // Skip over dbg_value instructions.
|
||||||
|
++Count;
|
||||||
|
|
||||||
for (unsigned i = 0, e = PrevMI->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = PrevMI->getNumOperands(); i != e; ++i) {
|
||||||
MachineOperand &MO = PrevMI->getOperand(i);
|
MachineOperand &MO = PrevMI->getOperand(i);
|
||||||
if (!MO.isReg() || MO.getReg() == 0)
|
if (!MO.isReg() || MO.getReg() == 0)
|
||||||
|
|
@ -1022,8 +1029,6 @@ static unsigned FindFreeRegister(MachineBasicBlock::iterator MII,
|
||||||
for (const unsigned *AS = TRI->getAliasSet(Reg); *AS; ++AS)
|
for (const unsigned *AS = TRI->getAliasSet(Reg); *AS; ++AS)
|
||||||
Uses.set(*AS);
|
Uses.set(*AS);
|
||||||
}
|
}
|
||||||
|
|
||||||
MII = PrevMI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1213,6 +1218,9 @@ OptimizeByUnfold2(unsigned VirtReg, int SS,
|
||||||
std::vector<MachineOperand*> &KillOps) {
|
std::vector<MachineOperand*> &KillOps) {
|
||||||
|
|
||||||
MachineBasicBlock::iterator NextMII = llvm::next(MII);
|
MachineBasicBlock::iterator NextMII = llvm::next(MII);
|
||||||
|
// Skip over dbg_value instructions.
|
||||||
|
while (NextMII != MBB->end() && NextMII->isDebugValue())
|
||||||
|
NextMII = llvm::next(NextMII);
|
||||||
if (NextMII == MBB->end())
|
if (NextMII == MBB->end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -1277,6 +1285,9 @@ OptimizeByUnfold2(unsigned VirtReg, int SS,
|
||||||
VRM->RemoveMachineInstrFromMaps(&NextMI);
|
VRM->RemoveMachineInstrFromMaps(&NextMI);
|
||||||
MBB->erase(&NextMI);
|
MBB->erase(&NextMI);
|
||||||
++NumModRefUnfold;
|
++NumModRefUnfold;
|
||||||
|
// Skip over dbg_value instructions.
|
||||||
|
while (NextMII != MBB->end() && NextMII->isDebugValue())
|
||||||
|
NextMII = llvm::next(NextMII);
|
||||||
if (NextMII == MBB->end())
|
if (NextMII == MBB->end())
|
||||||
break;
|
break;
|
||||||
} while (FoldsStackSlotModRef(*NextMII, SS, PhysReg, TII, TRI, *VRM));
|
} while (FoldsStackSlotModRef(*NextMII, SS, PhysReg, TII, TRI, *VRM));
|
||||||
|
|
@ -1622,7 +1633,7 @@ TransferDeadness(unsigned Reg, BitVector &RegKills,
|
||||||
for (MachineRegisterInfo::reg_iterator RI = MRI->reg_begin(Reg),
|
for (MachineRegisterInfo::reg_iterator RI = MRI->reg_begin(Reg),
|
||||||
RE = MRI->reg_end(); RI != RE; ++RI) {
|
RE = MRI->reg_end(); RI != RE; ++RI) {
|
||||||
MachineInstr *UDMI = &*RI;
|
MachineInstr *UDMI = &*RI;
|
||||||
if (UDMI->getParent() != MBB)
|
if (UDMI->isDebugValue() || UDMI->getParent() != MBB)
|
||||||
continue;
|
continue;
|
||||||
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(UDMI);
|
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(UDMI);
|
||||||
if (DI == DistanceMap.end())
|
if (DI == DistanceMap.end())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue