Skip to content

Commit 7efdd4f

Browse files
committed
[llvm][CodeGen] Modifications made based on review comments 1
1 parent 993262e commit 7efdd4f

File tree

2 files changed

+5
-31
lines changed

2 files changed

+5
-31
lines changed

llvm/include/llvm/CodeGen/ModuloSchedule.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ class ModuloScheduleExpander {
189189
/// Instructions to change when emitting the final schedule.
190190
InstrChangesTy InstrChanges;
191191

192-
/// Record the registers that need to compute live intervals.
193-
SmallSet<Register, 8> NoIntervalRegs;
194-
195192
void generatePipelinedLoop();
196193
void generateProlog(unsigned LastStage, MachineBasicBlock *KernelBB,
197194
ValueMapTy *VRMap, MBBVectorTy &PrologBBs);
@@ -215,7 +212,6 @@ class ModuloScheduleExpander {
215212
void addBranches(MachineBasicBlock &PreheaderBB, MBBVectorTy &PrologBBs,
216213
MachineBasicBlock *KernelBB, MBBVectorTy &EpilogBBs,
217214
ValueMapTy *VRMap);
218-
void calculateIntervals();
219215
bool computeDelta(MachineInstr &MI, unsigned &Delta);
220216
void updateMemOperands(MachineInstr &NewMI, MachineInstr &OldMI,
221217
unsigned Num);

llvm/lib/CodeGen/ModuloSchedule.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,6 @@ void ModuloScheduleExpander::generatePipelinedLoop() {
181181
// Add branches between prolog and epilog blocks.
182182
addBranches(*Preheader, PrologBBs, KernelBB, EpilogBBs, VRMap);
183183

184-
// The intervals of newly created virtual registers are calculated after the
185-
// kernel expansion.
186-
calculateIntervals();
187-
188184
delete[] VRMap;
189185
delete[] VRMapPhi;
190186
}
@@ -549,10 +545,8 @@ void ModuloScheduleExpander::generateExistingPhis(
549545
if (VRMap[LastStageNum - np - 1].count(LoopVal))
550546
PhiOp2 = VRMap[LastStageNum - np - 1][LoopVal];
551547

552-
if (IsLast && np == NumPhis - 1) {
548+
if (IsLast && np == NumPhis - 1)
553549
replaceRegUsesAfterLoop(Def, NewReg, BB, MRI);
554-
NoIntervalRegs.insert(NewReg);
555-
}
556550
continue;
557551
}
558552
}
@@ -592,10 +586,8 @@ void ModuloScheduleExpander::generateExistingPhis(
592586
// Check if we need to rename any uses that occurs after the loop. The
593587
// register to replace depends on whether the Phi is scheduled in the
594588
// epilog.
595-
if (IsLast && np == NumPhis - 1) {
589+
if (IsLast && np == NumPhis - 1)
596590
replaceRegUsesAfterLoop(Def, NewReg, BB, MRI);
597-
NoIntervalRegs.insert(NewReg);
598-
}
599591

600592
// In the kernel, a dependent Phi uses the value from this Phi.
601593
if (InKernel)
@@ -615,10 +607,8 @@ void ModuloScheduleExpander::generateExistingPhis(
615607
if (NumStages == 0 && IsLast) {
616608
auto &CurStageMap = VRMap[CurStageNum];
617609
auto It = CurStageMap.find(LoopVal);
618-
if (It != CurStageMap.end()) {
610+
if (It != CurStageMap.end())
619611
replaceRegUsesAfterLoop(Def, It->second, BB, MRI);
620-
NoIntervalRegs.insert(It->second);
621-
}
622612
}
623613
}
624614
}
@@ -738,10 +728,8 @@ void ModuloScheduleExpander::generatePhis(
738728
rewriteScheduledInstr(NewBB, InstrMap, CurStageNum, np, &*BBI, Def,
739729
NewReg);
740730
}
741-
if (IsLast && np == NumPhis - 1) {
731+
if (IsLast && np == NumPhis - 1)
742732
replaceRegUsesAfterLoop(Def, NewReg, BB, MRI);
743-
NoIntervalRegs.insert(NewReg);
744-
}
745733
}
746734
}
747735
}
@@ -953,14 +941,6 @@ void ModuloScheduleExpander::addBranches(MachineBasicBlock &PreheaderBB,
953941
}
954942
}
955943

956-
/// Some registers are generated during the kernel expansion. We calculate the
957-
/// live intervals of these registers after the expansion.
958-
void ModuloScheduleExpander::calculateIntervals() {
959-
for (Register Reg : NoIntervalRegs)
960-
LIS.createAndComputeVirtRegInterval(Reg);
961-
NoIntervalRegs.clear();
962-
}
963-
964944
/// Return true if we can compute the amount the instruction changes
965945
/// during each iteration. Set Delta to the amount of the change.
966946
bool ModuloScheduleExpander::computeDelta(MachineInstr &MI, unsigned &Delta) {
@@ -1081,10 +1061,8 @@ void ModuloScheduleExpander::updateInstruction(MachineInstr *NewMI,
10811061
Register NewReg = MRI.createVirtualRegister(RC);
10821062
MO.setReg(NewReg);
10831063
VRMap[CurStageNum][reg] = NewReg;
1084-
if (LastDef) {
1064+
if (LastDef)
10851065
replaceRegUsesAfterLoop(reg, NewReg, BB, MRI);
1086-
NoIntervalRegs.insert(NewReg);
1087-
}
10881066
} else if (MO.isUse()) {
10891067
MachineInstr *Def = MRI.getVRegDef(reg);
10901068
// Compute the stage that contains the last definition for instruction.

0 commit comments

Comments
 (0)