mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[CSSPGO] Exclude pseudo probes from slot index
Pseudo probe are currently given a slot index like other regular instructions. This affects register pressure and lifetime weight computation because of enlarged lifetime length with pseudo probe instructions. As a consequence, program could get different code generated w/ and w/o pseudo probes. I'm closing the gap by excluding pseudo probes from stack index and downstream register allocation related passes. Reviewed By: wmi Differential Revision: https://reviews.llvm.org/D100334
This commit is contained in:
parent
1d3a18419c
commit
d0ebd8797c
@ -75,6 +75,11 @@ void LexicalScopes::extractLexicalScopes(
|
|||||||
const MachineInstr *PrevMI = nullptr;
|
const MachineInstr *PrevMI = nullptr;
|
||||||
const DILocation *PrevDL = nullptr;
|
const DILocation *PrevDL = nullptr;
|
||||||
for (const auto &MInsn : MBB) {
|
for (const auto &MInsn : MBB) {
|
||||||
|
// Ignore DBG_VALUE and similar instruction that do not contribute to any
|
||||||
|
// instruction in the output.
|
||||||
|
if (MInsn.isMetaInstruction())
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check if instruction has valid location information.
|
// Check if instruction has valid location information.
|
||||||
const DILocation *MIDL = MInsn.getDebugLoc();
|
const DILocation *MIDL = MInsn.getDebugLoc();
|
||||||
if (!MIDL) {
|
if (!MIDL) {
|
||||||
@ -88,11 +93,6 @@ void LexicalScopes::extractLexicalScopes(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore DBG_VALUE and similar instruction that do not contribute to any
|
|
||||||
// instruction in the output.
|
|
||||||
if (MInsn.isMetaInstruction())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (RangeBeginMI) {
|
if (RangeBeginMI) {
|
||||||
// If we have already seen a beginning of an instruction range and
|
// If we have already seen a beginning of an instruction range and
|
||||||
// current instruction scope does not match scope of first instruction
|
// current instruction scope does not match scope of first instruction
|
||||||
|
@ -870,7 +870,7 @@ bool LDVImpl::collectDebugValues(MachineFunction &mf) {
|
|||||||
MBBI != MBBE;) {
|
MBBI != MBBE;) {
|
||||||
// Use the first debug instruction in the sequence to get a SlotIndex
|
// Use the first debug instruction in the sequence to get a SlotIndex
|
||||||
// for following consecutive debug instructions.
|
// for following consecutive debug instructions.
|
||||||
if (!MBBI->isDebugInstr()) {
|
if (!MBBI->isDebugOrPseudoInstr()) {
|
||||||
++MBBI;
|
++MBBI;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -891,7 +891,7 @@ bool LDVImpl::collectDebugValues(MachineFunction &mf) {
|
|||||||
Changed = true;
|
Changed = true;
|
||||||
} else
|
} else
|
||||||
++MBBI;
|
++MBBI;
|
||||||
} while (MBBI != MBBE && MBBI->isDebugInstr());
|
} while (MBBI != MBBE && MBBI->isDebugOrPseudoInstr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Changed;
|
return Changed;
|
||||||
|
@ -1484,7 +1484,7 @@ private:
|
|||||||
|
|
||||||
MachineBasicBlock::iterator Begin = MBB->begin();
|
MachineBasicBlock::iterator Begin = MBB->begin();
|
||||||
while (MII != Begin) {
|
while (MII != Begin) {
|
||||||
if ((--MII)->isDebugInstr())
|
if ((--MII)->isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
SlotIndex Idx = Indexes->getInstructionIndex(*MII);
|
SlotIndex Idx = Indexes->getInstructionIndex(*MII);
|
||||||
|
|
||||||
@ -1579,7 +1579,7 @@ void LiveIntervals::repairOldRegInRange(const MachineBasicBlock::iterator Begin,
|
|||||||
for (MachineBasicBlock::iterator I = End; I != Begin;) {
|
for (MachineBasicBlock::iterator I = End; I != Begin;) {
|
||||||
--I;
|
--I;
|
||||||
MachineInstr &MI = *I;
|
MachineInstr &MI = *I;
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SlotIndex instrIdx = getInstructionIndex(MI);
|
SlotIndex instrIdx = getInstructionIndex(MI);
|
||||||
@ -1676,7 +1676,7 @@ LiveIntervals::repairIntervalsInRange(MachineBasicBlock *MBB,
|
|||||||
for (MachineBasicBlock::iterator I = End; I != Begin;) {
|
for (MachineBasicBlock::iterator I = End; I != Begin;) {
|
||||||
--I;
|
--I;
|
||||||
MachineInstr &MI = *I;
|
MachineInstr &MI = *I;
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
for (MachineInstr::const_mop_iterator MOI = MI.operands_begin(),
|
for (MachineInstr::const_mop_iterator MOI = MI.operands_begin(),
|
||||||
MOE = MI.operands_end();
|
MOE = MI.operands_end();
|
||||||
|
@ -130,7 +130,7 @@ bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
for (MachineBasicBlock::iterator Next = MBB.begin(); Next != MBB.end();) {
|
for (MachineBasicBlock::iterator Next = MBB.begin(); Next != MBB.end();) {
|
||||||
MachineInstr &MI = *Next;
|
MachineInstr &MI = *Next;
|
||||||
++Next;
|
++Next;
|
||||||
if (MI.isPHI() || MI.isDebugInstr())
|
if (MI.isPHI() || MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
if (MI.mayStore())
|
if (MI.mayStore())
|
||||||
SawStore = true;
|
SawStore = true;
|
||||||
@ -219,7 +219,7 @@ bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
if (DefMO && Insert && NumEligibleUse > 1 && Barrier <= IOM[Insert]) {
|
if (DefMO && Insert && NumEligibleUse > 1 && Barrier <= IOM[Insert]) {
|
||||||
MachineBasicBlock::iterator I = std::next(Insert->getIterator());
|
MachineBasicBlock::iterator I = std::next(Insert->getIterator());
|
||||||
// Skip all the PHI and debug instructions.
|
// Skip all the PHI and debug instructions.
|
||||||
while (I != MBB.end() && (I->isPHI() || I->isDebugInstr()))
|
while (I != MBB.end() && (I->isPHI() || I->isDebugOrPseudoInstr()))
|
||||||
I = std::next(I);
|
I = std::next(I);
|
||||||
if (I == MI.getIterator())
|
if (I == MI.getIterator())
|
||||||
continue;
|
continue;
|
||||||
|
@ -497,7 +497,7 @@ void LiveVariables::UpdatePhysRegDefs(MachineInstr &MI,
|
|||||||
|
|
||||||
void LiveVariables::runOnInstr(MachineInstr &MI,
|
void LiveVariables::runOnInstr(MachineInstr &MI,
|
||||||
SmallVectorImpl<unsigned> &Defs) {
|
SmallVectorImpl<unsigned> &Defs) {
|
||||||
assert(!MI.isDebugInstr());
|
assert(!MI.isDebugOrPseudoInstr());
|
||||||
// Process all of the operands of the instruction...
|
// Process all of the operands of the instruction...
|
||||||
unsigned NumOperandsToProcess = MI.getNumOperands();
|
unsigned NumOperandsToProcess = MI.getNumOperands();
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ void LiveVariables::runOnBlock(MachineBasicBlock *MBB, const unsigned NumRegs) {
|
|||||||
DistanceMap.clear();
|
DistanceMap.clear();
|
||||||
unsigned Dist = 0;
|
unsigned Dist = 0;
|
||||||
for (MachineInstr &MI : *MBB) {
|
for (MachineInstr &MI : *MBB) {
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
DistanceMap.insert(std::make_pair(&MI, Dist++));
|
DistanceMap.insert(std::make_pair(&MI, Dist++));
|
||||||
|
|
||||||
|
@ -1515,7 +1515,7 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
|
|||||||
// Try searching forwards from Before, looking for reads or defs.
|
// Try searching forwards from Before, looking for reads or defs.
|
||||||
const_iterator I(Before);
|
const_iterator I(Before);
|
||||||
for (; I != end() && N > 0; ++I) {
|
for (; I != end() && N > 0; ++I) {
|
||||||
if (I->isDebugInstr())
|
if (I->isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
--N;
|
--N;
|
||||||
@ -1553,7 +1553,7 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
|
|||||||
do {
|
do {
|
||||||
--I;
|
--I;
|
||||||
|
|
||||||
if (I->isDebugInstr())
|
if (I->isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
--N;
|
--N;
|
||||||
@ -1587,7 +1587,7 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
|
|||||||
|
|
||||||
// If all the instructions before this in the block are debug instructions,
|
// If all the instructions before this in the block are debug instructions,
|
||||||
// skip over them.
|
// skip over them.
|
||||||
while (I != begin() && std::prev(I)->isDebugInstr())
|
while (I != begin() && std::prev(I)->isDebugOrPseudoInstr())
|
||||||
--I;
|
--I;
|
||||||
|
|
||||||
// Did we get to the start of the block?
|
// Did we get to the start of the block?
|
||||||
|
@ -297,7 +297,7 @@ priorNonDebug(MachineBasicBlock::const_iterator I,
|
|||||||
MachineBasicBlock::const_iterator Beg) {
|
MachineBasicBlock::const_iterator Beg) {
|
||||||
assert(I != Beg && "reached the top of the region, cannot decrement");
|
assert(I != Beg && "reached the top of the region, cannot decrement");
|
||||||
while (--I != Beg) {
|
while (--I != Beg) {
|
||||||
if (!I->isDebugInstr())
|
if (!I->isDebugOrPseudoInstr())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return I;
|
return I;
|
||||||
@ -317,7 +317,7 @@ static MachineBasicBlock::const_iterator
|
|||||||
nextIfDebug(MachineBasicBlock::const_iterator I,
|
nextIfDebug(MachineBasicBlock::const_iterator I,
|
||||||
MachineBasicBlock::const_iterator End) {
|
MachineBasicBlock::const_iterator End) {
|
||||||
for(; I != End; ++I) {
|
for(; I != End; ++I) {
|
||||||
if (!I->isDebugInstr())
|
if (!I->isDebugOrPseudoInstr())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return I;
|
return I;
|
||||||
@ -508,7 +508,7 @@ getSchedRegions(MachineBasicBlock *MBB,
|
|||||||
MachineInstr &MI = *std::prev(I);
|
MachineInstr &MI = *std::prev(I);
|
||||||
if (isSchedBoundary(&MI, &*MBB, MF, TII))
|
if (isSchedBoundary(&MI, &*MBB, MF, TII))
|
||||||
break;
|
break;
|
||||||
if (!MI.isDebugInstr()) {
|
if (!MI.isDebugOrPseudoInstr()) {
|
||||||
// MBB::size() uses instr_iterator to count. Here we need a bundle to
|
// MBB::size() uses instr_iterator to count. Here we need a bundle to
|
||||||
// count as a single instruction.
|
// count as a single instruction.
|
||||||
++NumRegionInstrs;
|
++NumRegionInstrs;
|
||||||
|
@ -530,7 +530,7 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) {
|
|||||||
if (!ProcessedBegin)
|
if (!ProcessedBegin)
|
||||||
--I;
|
--I;
|
||||||
|
|
||||||
if (MI.isDebugInstr()) {
|
if (MI.isDebugOrPseudoInstr()) {
|
||||||
if (MI.isDebugValue())
|
if (MI.isDebugValue())
|
||||||
ProcessDbgInst(MI);
|
ProcessDbgInst(MI);
|
||||||
continue;
|
continue;
|
||||||
@ -718,7 +718,7 @@ MachineSinking::getBBRegisterPressure(MachineBasicBlock &MBB) {
|
|||||||
MIE = MBB.instr_begin();
|
MIE = MBB.instr_begin();
|
||||||
MII != MIE; --MII) {
|
MII != MIE; --MII) {
|
||||||
MachineInstr &MI = *std::prev(MII);
|
MachineInstr &MI = *std::prev(MII);
|
||||||
if (MI.isDebugValue() || MI.isDebugLabel())
|
if (MI.isDebugValue() || MI.isDebugLabel() || MI.isPseudoProbe())
|
||||||
continue;
|
continue;
|
||||||
RegisterOperands RegOpers;
|
RegisterOperands RegOpers;
|
||||||
RegOpers.collect(MI, *TRI, *MRI, false, false);
|
RegOpers.collect(MI, *TRI, *MRI, false, false);
|
||||||
@ -1755,7 +1755,7 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MI->isDebugInstr())
|
if (MI->isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Do not move any instruction across function call.
|
// Do not move any instruction across function call.
|
||||||
|
@ -1315,8 +1315,9 @@ bool RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
|
|||||||
// Abort if the spill cannot be inserted at the MBB' start
|
// Abort if the spill cannot be inserted at the MBB' start
|
||||||
MachineBasicBlock *MBB = MF->getBlockNumbered(Number);
|
MachineBasicBlock *MBB = MF->getBlockNumbered(Number);
|
||||||
if (!MBB->empty() &&
|
if (!MBB->empty() &&
|
||||||
SlotIndex::isEarlierInstr(LIS->getInstructionIndex(MBB->instr_front()),
|
SlotIndex::isEarlierInstr(
|
||||||
SA->getFirstSplitPoint(Number)))
|
LIS->getInstructionIndex(*MBB->getFirstNonDebugInstr()),
|
||||||
|
SA->getFirstSplitPoint(Number)))
|
||||||
return false;
|
return false;
|
||||||
// Interference for the live-in value.
|
// Interference for the live-in value.
|
||||||
if (Intf.first() <= Indexes->getMBBStartIdx(Number))
|
if (Intf.first() <= Indexes->getMBBStartIdx(Number))
|
||||||
|
@ -2962,7 +2962,7 @@ taintExtent(unsigned ValNo, LaneBitmask TaintedLanes, JoinVals &Other,
|
|||||||
|
|
||||||
bool JoinVals::usesLanes(const MachineInstr &MI, Register Reg, unsigned SubIdx,
|
bool JoinVals::usesLanes(const MachineInstr &MI, Register Reg, unsigned SubIdx,
|
||||||
LaneBitmask Lanes) const {
|
LaneBitmask Lanes) const {
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
return false;
|
return false;
|
||||||
for (const MachineOperand &MO : MI.operands()) {
|
for (const MachineOperand &MO : MI.operands()) {
|
||||||
if (!MO.isReg() || MO.isDef() || MO.getReg() != Reg)
|
if (!MO.isReg() || MO.isDef() || MO.getReg() != Reg)
|
||||||
@ -3607,7 +3607,7 @@ void RegisterCoalescer::buildVRegToDbgValueMap(MachineFunction &MF)
|
|||||||
return MO.isReg() && MO.getReg().isVirtual();
|
return MO.isReg() && MO.getReg().isVirtual();
|
||||||
}))
|
}))
|
||||||
ToInsert.push_back(&MI);
|
ToInsert.push_back(&MI);
|
||||||
} else if (!MI.isDebugInstr()) {
|
} else if (!MI.isDebugOrPseudoInstr()) {
|
||||||
CurrentSlot = Slots.getInstructionIndex(MI);
|
CurrentSlot = Slots.getInstructionIndex(MI);
|
||||||
CloseNewDVRange(CurrentSlot);
|
CloseNewDVRange(CurrentSlot);
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ void RegPressureTracker::bumpDeadDefs(ArrayRef<RegisterMaskPair> DeadDefs) {
|
|||||||
/// instruction independent of liveness.
|
/// instruction independent of liveness.
|
||||||
void RegPressureTracker::recede(const RegisterOperands &RegOpers,
|
void RegPressureTracker::recede(const RegisterOperands &RegOpers,
|
||||||
SmallVectorImpl<RegisterMaskPair> *LiveUses) {
|
SmallVectorImpl<RegisterMaskPair> *LiveUses) {
|
||||||
assert(!CurrPos->isDebugInstr());
|
assert(!CurrPos->isDebugOrPseudoInstr());
|
||||||
|
|
||||||
// Boost pressure for all dead defs together.
|
// Boost pressure for all dead defs together.
|
||||||
bumpDeadDefs(RegOpers.DeadDefs);
|
bumpDeadDefs(RegOpers.DeadDefs);
|
||||||
@ -863,7 +863,7 @@ void RegPressureTracker::recedeSkipDebugValues() {
|
|||||||
CurrPos = prev_nodbg(CurrPos, MBB->begin());
|
CurrPos = prev_nodbg(CurrPos, MBB->begin());
|
||||||
|
|
||||||
SlotIndex SlotIdx;
|
SlotIndex SlotIdx;
|
||||||
if (RequireIntervals && !CurrPos->isDebugInstr())
|
if (RequireIntervals && !CurrPos->isDebugOrPseudoInstr())
|
||||||
SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot();
|
SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot();
|
||||||
|
|
||||||
// Open the top of the region using slot indexes.
|
// Open the top of the region using slot indexes.
|
||||||
@ -873,9 +873,9 @@ void RegPressureTracker::recedeSkipDebugValues() {
|
|||||||
|
|
||||||
void RegPressureTracker::recede(SmallVectorImpl<RegisterMaskPair> *LiveUses) {
|
void RegPressureTracker::recede(SmallVectorImpl<RegisterMaskPair> *LiveUses) {
|
||||||
recedeSkipDebugValues();
|
recedeSkipDebugValues();
|
||||||
if (CurrPos->isDebugValue()) {
|
if (CurrPos->isDebugValue() || CurrPos->isPseudoProbe()) {
|
||||||
// It's possible to only have debug_value instructions and hit the start of
|
// It's possible to only have debug_value and pseudo probe instructions and
|
||||||
// the block.
|
// hit the start of the block.
|
||||||
assert(CurrPos == MBB->begin());
|
assert(CurrPos == MBB->begin());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1041,7 +1041,7 @@ static void computeMaxPressureDelta(ArrayRef<unsigned> OldMaxPressureVec,
|
|||||||
/// This is intended for speculative queries. It leaves pressure inconsistent
|
/// This is intended for speculative queries. It leaves pressure inconsistent
|
||||||
/// with the current position, so must be restored by the caller.
|
/// with the current position, so must be restored by the caller.
|
||||||
void RegPressureTracker::bumpUpwardPressure(const MachineInstr *MI) {
|
void RegPressureTracker::bumpUpwardPressure(const MachineInstr *MI) {
|
||||||
assert(!MI->isDebugInstr() && "Expect a nondebug instruction.");
|
assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction.");
|
||||||
|
|
||||||
SlotIndex SlotIdx;
|
SlotIndex SlotIdx;
|
||||||
if (RequireIntervals)
|
if (RequireIntervals)
|
||||||
@ -1282,7 +1282,7 @@ LaneBitmask RegPressureTracker::getLiveThroughAt(Register RegUnit,
|
|||||||
/// This is intended for speculative queries. It leaves pressure inconsistent
|
/// This is intended for speculative queries. It leaves pressure inconsistent
|
||||||
/// with the current position, so must be restored by the caller.
|
/// with the current position, so must be restored by the caller.
|
||||||
void RegPressureTracker::bumpDownwardPressure(const MachineInstr *MI) {
|
void RegPressureTracker::bumpDownwardPressure(const MachineInstr *MI) {
|
||||||
assert(!MI->isDebugInstr() && "Expect a nondebug instruction.");
|
assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction.");
|
||||||
|
|
||||||
SlotIndex SlotIdx;
|
SlotIndex SlotIdx;
|
||||||
if (RequireIntervals)
|
if (RequireIntervals)
|
||||||
|
@ -175,7 +175,7 @@ void RegScavenger::forward() {
|
|||||||
I.Restore = nullptr;
|
I.Restore = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
determineKillsAndDefs();
|
determineKillsAndDefs();
|
||||||
@ -298,7 +298,7 @@ Register RegScavenger::findSurvivorReg(MachineBasicBlock::iterator StartMI,
|
|||||||
|
|
||||||
bool inVirtLiveRange = false;
|
bool inVirtLiveRange = false;
|
||||||
for (++MI; InstrLimit > 0 && MI != ME; ++MI, --InstrLimit) {
|
for (++MI; InstrLimit > 0 && MI != ME; ++MI, --InstrLimit) {
|
||||||
if (MI->isDebugInstr()) {
|
if (MI->isDebugOrPseudoInstr()) {
|
||||||
++InstrLimit; // Don't count debug instructions
|
++InstrLimit; // Don't count debug instructions
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ void ScheduleDAGInstrs::addVRegDefDeps(SUnit *SU, unsigned OperIdx) {
|
|||||||
/// TODO: Handle ExitSU "uses" properly.
|
/// TODO: Handle ExitSU "uses" properly.
|
||||||
void ScheduleDAGInstrs::addVRegUseDeps(SUnit *SU, unsigned OperIdx) {
|
void ScheduleDAGInstrs::addVRegUseDeps(SUnit *SU, unsigned OperIdx) {
|
||||||
const MachineInstr *MI = SU->getInstr();
|
const MachineInstr *MI = SU->getInstr();
|
||||||
assert(!MI->isDebugInstr());
|
assert(!MI->isDebugOrPseudoInstr());
|
||||||
|
|
||||||
const MachineOperand &MO = MI->getOperand(OperIdx);
|
const MachineOperand &MO = MI->getOperand(OperIdx);
|
||||||
Register Reg = MO.getReg();
|
Register Reg = MO.getReg();
|
||||||
@ -572,7 +572,7 @@ void ScheduleDAGInstrs::initSUnits() {
|
|||||||
SUnits.reserve(NumRegionInstrs);
|
SUnits.reserve(NumRegionInstrs);
|
||||||
|
|
||||||
for (MachineInstr &MI : make_range(RegionBegin, RegionEnd)) {
|
for (MachineInstr &MI : make_range(RegionBegin, RegionEnd)) {
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SUnit *SU = newSUnit(&MI);
|
SUnit *SU = newSUnit(&MI);
|
||||||
@ -814,6 +814,9 @@ void ScheduleDAGInstrs::buildSchedGraph(AAResults *AA,
|
|||||||
if (MI.isDebugLabel())
|
if (MI.isDebugLabel())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (MI.isPseudoProbe())
|
||||||
|
continue;
|
||||||
|
|
||||||
SUnit *SU = MISUnitMap[&MI];
|
SUnit *SU = MISUnitMap[&MI];
|
||||||
assert(SU && "No SUnit mapped to this MI");
|
assert(SU && "No SUnit mapped to this MI");
|
||||||
|
|
||||||
@ -1117,7 +1120,7 @@ void ScheduleDAGInstrs::fixupKills(MachineBasicBlock &MBB) {
|
|||||||
|
|
||||||
// Examine block from end to start...
|
// Examine block from end to start...
|
||||||
for (MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend())) {
|
for (MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend())) {
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Update liveness. Registers that are defed but not used in this
|
// Update liveness. Registers that are defed but not used in this
|
||||||
@ -1152,7 +1155,7 @@ void ScheduleDAGInstrs::fixupKills(MachineBasicBlock &MBB) {
|
|||||||
while (I->isBundledWithSucc())
|
while (I->isBundledWithSucc())
|
||||||
++I;
|
++I;
|
||||||
do {
|
do {
|
||||||
if (!I->isDebugInstr())
|
if (!I->isDebugOrPseudoInstr())
|
||||||
toggleKills(MRI, LiveRegs, *I, true);
|
toggleKills(MRI, LiveRegs, *I, true);
|
||||||
--I;
|
--I;
|
||||||
} while (I != Bundle);
|
} while (I != Bundle);
|
||||||
|
@ -83,7 +83,7 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
SlotIndex blockStartIndex(&indexList.back(), SlotIndex::Slot_Block);
|
SlotIndex blockStartIndex(&indexList.back(), SlotIndex::Slot_Block);
|
||||||
|
|
||||||
for (MachineInstr &MI : MBB) {
|
for (MachineInstr &MI : MBB) {
|
||||||
if (MI.isDebugInstr())
|
if (MI.isDebugOrPseudoInstr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Insert a store index for the instr.
|
// Insert a store index for the instr.
|
||||||
@ -241,7 +241,7 @@ void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB,
|
|||||||
for (MachineBasicBlock::iterator I = End; I != Begin;) {
|
for (MachineBasicBlock::iterator I = End; I != Begin;) {
|
||||||
--I;
|
--I;
|
||||||
MachineInstr &MI = *I;
|
MachineInstr &MI = *I;
|
||||||
if (!MI.isDebugInstr() && mi2iMap.find(&MI) == mi2iMap.end())
|
if (!MI.isDebugOrPseudoInstr() && mi2iMap.find(&MI) == mi2iMap.end())
|
||||||
insertMachineInstrInMaps(MI);
|
insertMachineInstrInMaps(MI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -819,7 +819,7 @@ void SplitEditor::removeBackCopies(SmallVectorImpl<VNInfo*> &Copies) {
|
|||||||
MachineBasicBlock::iterator MBBI(MI);
|
MachineBasicBlock::iterator MBBI(MI);
|
||||||
bool AtBegin;
|
bool AtBegin;
|
||||||
do AtBegin = MBBI == MBB->begin();
|
do AtBegin = MBBI == MBB->begin();
|
||||||
while (!AtBegin && (--MBBI)->isDebugInstr());
|
while (!AtBegin && (--MBBI)->isDebugOrPseudoInstr());
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << "Removing " << Def << '\t' << *MI);
|
LLVM_DEBUG(dbgs() << "Removing " << Def << '\t' << *MI);
|
||||||
LIS.removeVRegDefAt(*LI, Def);
|
LIS.removeVRegDefAt(*LI, Def);
|
||||||
|
22
test/Transforms/SampleProfile/pseudo-probe-slotindex.ll
Normal file
22
test/Transforms/SampleProfile/pseudo-probe-slotindex.ll
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
; REQUIRES: x86_64-linux
|
||||||
|
; RUN: llc -print-after=slotindexes -stop-after=slotindexes -mtriple=x86_64-- %s -filetype=asm -o %t 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
define void @foo(i32* %p) {
|
||||||
|
store i32 0, i32* %p
|
||||||
|
call void @llvm.pseudoprobe(i64 5116412291814990879, i64 1, i32 0, i64 -1)
|
||||||
|
store i32 0, i32* %p
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
;; Check the pseudo probe instruction isn't assigned a slot index.
|
||||||
|
;CHECK: IR Dump {{.*}}
|
||||||
|
;CHECK: # Machine code for function foo{{.*}}
|
||||||
|
;CHECK: {{[0-9]+}}B bb.0 (%ir-block.0)
|
||||||
|
;CHECK: {{[0-9]+}}B %0:gr64 = COPY killed $rdi
|
||||||
|
;CHECK: {{^}} PSEUDO_PROBE 5116412291814990879
|
||||||
|
;CHECK: {{[0-9]+}}B MOV32mi
|
||||||
|
;CHECK: {{[0-9]+}}B RET 0
|
||||||
|
|
||||||
|
declare void @llvm.pseudoprobe(i64, i64, i32, i64) #0
|
||||||
|
|
||||||
|
attributes #0 = { inaccessiblememonly nounwind willreturn }
|
Loading…
Reference in New Issue
Block a user