Skip to content

Commit e871e83

Browse files
committed
Made the following suggested changes.
Raised another PR itself to deal with generic changes in StackSlotColoring pass needed to resolve current ticket. Merged multiple mir test cases into one to be concise.
1 parent bc497d7 commit e871e83

7 files changed

+356
-389
lines changed

llvm/include/llvm/CodeGen/Passes.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ namespace llvm {
283283
/// critical-path and resource depth.
284284
extern char &MachineCombinerID;
285285

286-
/// StackSlotColoring - This pass performs stack coloring and merging.
286+
/// StackColoring - This pass performs stack coloring and merging.
287287
/// It merges disjoint allocas to reduce the stack size.
288288
extern char &StackColoringID;
289289

@@ -371,8 +371,6 @@ namespace llvm {
371371

372372
/// StackSlotColoring - This pass performs stack slot coloring.
373373
extern char &StackSlotColoringID;
374-
FunctionPass *
375-
createStackSlotColoring(bool preserveRegAllocNeededAnalysis = false);
376374

377375
/// This pass lays out funclets contiguously.
378376
extern char &FuncletLayoutID;

llvm/lib/CodeGen/StackSlotColoring.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ namespace {
6565
MachineFrameInfo *MFI = nullptr;
6666
const TargetInstrInfo *TII = nullptr;
6767
const MachineBlockFrequencyInfo *MBFI = nullptr;
68-
SlotIndexes *Indexes = nullptr;
69-
70-
// - preserves Analysis passes in case RA may be called afterwards.
71-
bool preserveRegAllocNeededAnalysis = false;
7268

7369
// SSIntervals - Spill slot intervals.
7470
std::vector<LiveInterval*> SSIntervals;
@@ -145,9 +141,7 @@ namespace {
145141
public:
146142
static char ID; // Pass identification
147143

148-
StackSlotColoring(bool preserveRegAllocNeededAnalysis_ = false)
149-
: MachineFunctionPass(ID),
150-
preserveRegAllocNeededAnalysis(preserveRegAllocNeededAnalysis_) {
144+
StackSlotColoring() : MachineFunctionPass(ID) {
151145
initializeStackSlotColoringPass(*PassRegistry::getPassRegistry());
152146
}
153147

@@ -533,7 +527,6 @@ bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
533527
TII = MF.getSubtarget().getInstrInfo();
534528
LS = &getAnalysis<LiveStacks>();
535529
MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
536-
Indexes = &getAnalysis<SlotIndexes>();
537530

538531
bool Changed = false;
539532

@@ -567,9 +560,4 @@ bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
567560
Assignments.clear();
568561

569562
return Changed;
570-
}
571-
572-
FunctionPass *
573-
llvm::createStackSlotColoring(bool preserveRegAllocNeededAnalysis) {
574-
return new StackSlotColoring(preserveRegAllocNeededAnalysis);
575563
}

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ bool GCNPassConfig::addRegAssignAndRewriteOptimized() {
14251425
// through SGPRAllocPass. So, invoking StackSlotColoring here, may allow these
14261426
// SGPR spills to re-use stack slots, before these spills is further lowered
14271427
// down via SILowerSGPRSpills(i.e. equivalent of PEI for SGPRs).
1428-
addPass(createStackSlotColoring(/*preserveRegAllocNeededAnalysis*/ true));
1428+
addPass(&StackSlotColoringID);
14291429

14301430
// Equivalent of PEI for SGPRs.
14311431
addPass(&SILowerSGPRSpillsID);

llvm/test/CodeGen/AMDGPU/stack-slot-color-after-sgpr-alloc-equal-size-stack-objects.mir

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)