Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions llvm/lib/CodeGen/WindowScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ bool WindowScheduler::initialize() {
SmallVector<Register, 8> PhiDefs;
auto PLI = TII->analyzeLoopForPipelining(MBB);
for (auto &MI : *MBB) {
if (MI.isDebugInstr() || MI.isTerminator())
if (MI.isMetaInstruction() || MI.isTerminator())
continue;
if (MI.isPHI()) {
for (auto Def : PhiDefs)
Expand All @@ -222,7 +222,7 @@ bool WindowScheduler::initialize() {
"window scheduling!\n");
return false;
}
for (auto &Def : MI.defs())
for (auto &Def : MI.all_defs())
if (Def.isReg() && Def.getReg().isPhysical())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this ignore dead defs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we believe that dead defs do not need a special handling process.

return false;
}
Expand Down Expand Up @@ -285,7 +285,7 @@ void WindowScheduler::generateTripleMBB() {
// DefPairs hold the old and new define register pairs.
DenseMap<Register, Register> DefPairs;
for (auto *MI : OriMIs) {
if (MI->isDebugInstr() || MI->isTerminator())
if (MI->isMetaInstruction() || MI->isTerminator())
continue;
if (MI->isPHI())
if (Register AntiReg = getAntiRegister(MI))
Expand All @@ -300,13 +300,13 @@ void WindowScheduler::generateTripleMBB() {
// are updated accordingly.
for (size_t Cnt = 1; Cnt < DuplicateNum; ++Cnt) {
for (auto *MI : OriMIs) {
if (MI->isPHI() || MI->isDebugInstr() ||
if (MI->isPHI() || MI->isMetaInstruction() ||
(MI->isTerminator() && Cnt < DuplicateNum - 1))
continue;
auto *NewMI = MF->CloneMachineInstr(MI);
DenseMap<Register, Register> NewDefs;
// New defines are updated.
for (auto MO : NewMI->defs())
for (auto MO : NewMI->all_defs())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these type of changes should have tests to go with them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we have added test cases for dead def, implicit-def, and meta instruction.

if (MO.isReg() && MO.getReg().isVirtual()) {
Register NewDef =
MRI->createVirtualRegister(MRI->getRegClass(MO.getReg()));
Expand Down Expand Up @@ -666,7 +666,7 @@ unsigned WindowScheduler::getOriStage(MachineInstr *OriMI, unsigned Offset) {
// while the rest are set to 1.
unsigned Id = 0;
for (auto *MI : OriMIs) {
if (MI->isDebugInstr())
if (MI->isMetaInstruction())
continue;
if (MI == OriMI)
break;
Expand Down