Skip to content

Commit 42fbe83

Browse files
authored
[AMDGPU][NFC] Explain needsFrameMoves workaround (#2806)
2 parents 22d8dc4 + 3e66bec commit 42fbe83

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

llvm/lib/Target/AMDGPU/SIFrameLowering.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ static MCRegister findUnusedRegister(MachineRegisterInfo &MRI,
4848
return MCRegister();
4949
}
5050

51+
static bool needsFrameMoves(const MachineFunction &MF) {
52+
// FIXME: There are some places in the compiler which are sensitive to the CFI
53+
// pseudos and so using MachineFunction::needsFrameMoves has the unintended
54+
// effect of making enabling debug info affect codegen. Once we have
55+
// identified and fixed those cases this should be replaced with
56+
// MF.needsFrameMoves()
57+
return true;
58+
}
59+
5160
static void encodeDwarfRegisterLocation(int DwarfReg, raw_ostream &OS) {
5261
assert(DwarfReg >= 0);
5362
if (DwarfReg < 32) {
@@ -485,8 +494,7 @@ class PrologEpilogSGPRSpillBuilder {
485494
SplitParts = TRI.getRegSplitParts(RC, EltSize);
486495
NumSubRegs = SplitParts.empty() ? 1 : SplitParts.size();
487496

488-
// FIXME: Switch to using MF.needsFrameMoves() later.
489-
NeedsFrameMoves = true;
497+
NeedsFrameMoves = needsFrameMoves(MF);
490498

491499
assert(SuperReg != AMDGPU::M0 && "m0 should never spill");
492500
}
@@ -769,8 +777,7 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF,
769777
DebugLoc DL;
770778
MachineBasicBlock::iterator I = MBB.begin();
771779

772-
// FIXME: Switch to using MF.needsFrameMoves() later
773-
const bool NeedsFrameMoves = true;
780+
const bool NeedsFrameMoves = needsFrameMoves(MF);
774781

775782
if (NeedsFrameMoves) {
776783
// On entry the SP/FP are not set up, so we need to define the CFA in terms
@@ -1441,8 +1448,7 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
14411448
uint32_t NumBytes = MFI.getStackSize();
14421449
uint32_t RoundedSize = NumBytes;
14431450

1444-
// FIXME: Switch to using MF.needsFrameMoves() later
1445-
const bool NeedsFrameMoves = true;
1451+
const bool NeedsFrameMoves = needsFrameMoves(MF);
14461452

14471453
if (NeedsFrameMoves)
14481454
emitPrologueEntryCFI(MBB, MBBI, DL);
@@ -1632,8 +1638,7 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF,
16321638
FramePtrRegScratchCopy);
16331639
}
16341640

1635-
// FIXME: Switch to using MF.needsFrameMoves() later
1636-
const bool NeedsFrameMoves = true;
1641+
const bool NeedsFrameMoves = needsFrameMoves(MF);
16371642
if (hasFP(MF)) {
16381643
if (NeedsFrameMoves)
16391644
emitDefCFA(MBB, MBBI, DL, StackPtrReg, /*AspaceAlreadyDefined=*/false,

0 commit comments

Comments
 (0)