Skip to content

Commit b9d7794

Browse files
committed
Rebase. Updates per latest review. Squash.
1 parent 5bc72a9 commit b9d7794

16 files changed

+599
-379
lines changed

llvm/include/llvm/CodeGen/MachineScheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ class GenericSchedulerBase : public MachineSchedStrategy {
12301230
};
12311231

12321232
// Utility functions used by heuristics in tryCandidate().
1233-
unsigned computeRemLatency(SchedBoundary &CurrZone); // XXX LLVM_ABI?
1233+
LLVM_ABI unsigned computeRemLatency(SchedBoundary &CurrZone);
12341234
LLVM_ABI bool tryLess(int TryVal, int CandVal,
12351235
GenericSchedulerBase::SchedCandidate &TryCand,
12361236
GenericSchedulerBase::SchedCandidate &Cand,

llvm/include/llvm/CodeGen/RegisterPressure.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ class RegPressureTracker {
413413
/// tracker before the first call to advance/recede.
414414
LLVM_ABI void addLiveRegs(ArrayRef<VRegMaskOrUnit> Regs);
415415

416+
bool isRegLive(Register Reg) const { return LiveRegs.contains(Reg).any(); }
417+
416418
/// Get the MI position corresponding to this register pressure.
417419
MachineBasicBlock::const_iterator getPos() const { return CurrPos; }
418420

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ STATISTIC(NumOnly1PreRA,
9595
"Number of scheduling units chosen for Only1 heuristic pre-RA");
9696
STATISTIC(NumPhysRegPreRA,
9797
"Number of scheduling units chosen for PhysReg heuristic pre-RA");
98+
STATISTIC(NumLiveReducePreRA,
99+
"Number of scheduling units chosen for LiveReduce heuristic pre-RA");
98100
STATISTIC(NumRegExcessPreRA,
99101
"Number of scheduling units chosen for RegExcess heuristic pre-RA");
100102
STATISTIC(NumRegCriticalPreRA,
@@ -140,6 +142,8 @@ STATISTIC(NumOnly1PostRA,
140142
"Number of scheduling units chosen for Only1 heuristic post-RA");
141143
STATISTIC(NumPhysRegPostRA,
142144
"Number of scheduling units chosen for PhysReg heuristic post-RA");
145+
STATISTIC(NumLiveReducePostRA,
146+
"Number of scheduling units chosen for LiveReduce heuristic post-RA");
143147
STATISTIC(NumRegExcessPostRA,
144148
"Number of scheduling units chosen for RegExcess heuristic post-RA");
145149
STATISTIC(
@@ -3524,6 +3528,9 @@ static void tracePick(GenericSchedulerBase::CandReason Reason, bool IsTop,
35243528
case GenericScheduler::PhysReg:
35253529
NumPhysRegPostRA++;
35263530
return;
3531+
case GenericScheduler::LivenessReduce:
3532+
NumLiveReducePostRA++;
3533+
return;
35273534
case GenericScheduler::RegExcess:
35283535
NumRegExcessPostRA++;
35293536
return;
@@ -3583,6 +3590,9 @@ static void tracePick(GenericSchedulerBase::CandReason Reason, bool IsTop,
35833590
case GenericScheduler::PhysReg:
35843591
NumPhysRegPreRA++;
35853592
return;
3593+
case GenericScheduler::LivenessReduce:
3594+
NumLiveReducePreRA++;
3595+
return;
35863596
case GenericScheduler::RegExcess:
35873597
NumRegExcessPreRA++;
35883598
return;

llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,26 +2162,20 @@ bool SystemZInstrInfo::isLoadAndTestAsCmp(const MachineInstr &MI) const {
21622162
return (MI.getOpcode() == SystemZ::LTEBR ||
21632163
MI.getOpcode() == SystemZ::LTDBR ||
21642164
MI.getOpcode() == SystemZ::LTXBR) &&
2165-
MI.getOperand(0).isDead();
2165+
MI.getOperand(0).isDead();
21662166
}
21672167

21682168
bool SystemZInstrInfo::isCompareZero(const MachineInstr &Compare) const {
21692169
if (isLoadAndTestAsCmp(Compare))
21702170
return true;
21712171
return Compare.isCompare() && Compare.getNumExplicitOperands() == 2 &&
2172-
Compare.getOperand(1).isImm() && Compare.getOperand(1).getImm() == 0;
2172+
Compare.getOperand(1).isImm() && Compare.getOperand(1).getImm() == 0;
21732173
}
21742174

2175-
unsigned SystemZInstrInfo::
2176-
getCompareSourceReg(const MachineInstr &Compare) const {
2177-
unsigned reg = 0;
2178-
if (Compare.isCompare())
2179-
reg = Compare.getOperand(0).getReg();
2180-
else if (isLoadAndTestAsCmp(Compare))
2181-
reg = Compare.getOperand(1).getReg();
2182-
assert(reg);
2183-
2184-
return reg;
2175+
Register
2176+
SystemZInstrInfo::getCompareSourceReg(const MachineInstr &Compare) const {
2177+
assert(isCompareZero(Compare) && "Expected a compare with 0.");
2178+
return Compare.getOperand(isLoadAndTestAsCmp(Compare) ? 1 : 0).getReg();
21852179
}
21862180

21872181
bool SystemZInstrInfo::

llvm/lib/Target/SystemZ/SystemZInstrInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class SystemZInstrInfo : public SystemZGenInstrInfo {
365365

366366
// Return the source register of Compare, which is the unknown value
367367
// being tested.
368-
unsigned getCompareSourceReg(const MachineInstr &Compare) const;
368+
Register getCompareSourceReg(const MachineInstr &Compare) const;
369369

370370
// Try to find all CC users of the compare instruction (MBBI) and update
371371
// all of them to maintain equivalent behavior after swapping the compare

0 commit comments

Comments
 (0)