Skip to content

Commit dfed487

Browse files
dlei6gigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: b9b2e02
Don't write the FP to stack for leaf functions, saves an extra store.
1 parent 4adccbd commit dfed487

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10064,7 +10064,7 @@ void EmitPass::InitializeKernelStack(Function* pKernel)
1006410064
emitAddPointer(pSP, pStackBufferBase, pThreadOffset);
1006510065

1006610066
// Push a new stack frame
10067-
emitPushFrameToStack(totalAllocaSize, pKernel);
10067+
emitPushFrameToStack(totalAllocaSize);
1006810068

1006910069
// Set the total alloca size for the entry function
1007010070
m_encoder->SetFunctionAllocaStackSize(pKernel, totalAllocaSize);
@@ -10476,7 +10476,7 @@ void EmitPass::emitStackFuncEntry(Function* F)
1047610476
m_currShader->SaveStackState();
1047710477

1047810478
// Push a new stack frame
10479-
emitPushFrameToStack(totalAllocaSize, F);
10479+
emitPushFrameToStack(totalAllocaSize);
1048010480

1048110481
// Set the per-function private mem size
1048210482
m_encoder->SetFunctionAllocaStackSize(F, totalAllocaSize);
@@ -16362,22 +16362,16 @@ void EmitPass::emitGenISACopy(GenIntrinsicInst* GenCopyInst)
1636216362
// Update FP to the current SP
1636316363
// Increment SP by pushSize
1636416364
// Store value of previous frame's FP to the address of updated FP (for stack-walk)
16365-
void EmitPass::emitPushFrameToStack(unsigned& pushSize, Function* F)
16365+
void EmitPass::emitPushFrameToStack(unsigned& pushSize)
1636616366
{
1636716367
CVariable* pFP = m_currShader->GetFP();
1636816368
CVariable* pSP = m_currShader->GetSP();
16369-
bool WriteOldFPToStack = IGC_IS_FLAG_ENABLED(EnableWriteOldFPToStack);
16370-
if (m_FGA && m_FGA->isLeafFunc(F))
16371-
{
16372-
// We don't need to do this if the function is already a leaf
16373-
WriteOldFPToStack = false;
16374-
}
1637516369

1637616370
// Set FP = SP
1637716371
m_encoder->Copy(pFP, pSP);
1637816372
m_encoder->Push();
1637916373

16380-
if (WriteOldFPToStack)
16374+
if IGC_IS_FLAG_ENABLED(EnableWriteOldFPToStack)
1638116375
{
1638216376
// Allocate 1 extra oword to store previous frame's FP
1638316377
pushSize += SIZE_OWORD;
@@ -16386,7 +16380,7 @@ void EmitPass::emitPushFrameToStack(unsigned& pushSize, Function* F)
1638616380
// Update SP by pushSize
1638716381
emitAddPointer(pSP, pSP, m_currShader->ImmToVariable(pushSize, ISA_TYPE_UD));
1638816382

16389-
if (WriteOldFPToStack)
16383+
if IGC_IS_FLAG_ENABLED(EnableWriteOldFPToStack)
1639016384
{
1639116385
// Store old FP value to current FP
1639216386
CVariable* pOldFP = m_currShader->GetPrevFP();

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class EmitPass : public llvm::FunctionPass
426426
uint32_t DstSubRegOffset = 0, uint32_t SrcSubRegOffset = 0);
427427
void emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty);
428428

429-
void emitPushFrameToStack(unsigned& pushSize, llvm::Function* F);
429+
void emitPushFrameToStack(unsigned& pushSize);
430430
void emitAddPointer(CVariable* Dst, CVariable* Src, CVariable* offset);
431431
// emitAddPair - emulate 64bit addtition by 32-bit operations.
432432
// Dst and Src0 must be a 64-bit type variable.

0 commit comments

Comments
 (0)