[llvm] r357087 - PEI: Delay checking requiresFrameIndexReplacementScavenging
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 27 09:37:32 PDT 2019
Author: arsenm
Date: Wed Mar 27 09:37:31 2019
New Revision: 357087
URL: http://llvm.org/viewvc/llvm-project?rev=357087&view=rev
Log:
PEI: Delay checking requiresFrameIndexReplacementScavenging
Currently this is called before the frame size is set on the
function. For AMDGPU, the scavenger is used for large frames where
part of the offset needs to be materialized in a register, so
estimating the frame size is useful for knowing whether the scavenger
is useful.
Modified:
llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=357087&r1=357086&r2=357087&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Wed Mar 27 09:37:31 2019
@@ -218,8 +218,6 @@ bool PEI::runOnMachineFunction(MachineFu
RS = TRI->requiresRegisterScavenging(MF) ? new RegScavenger() : nullptr;
FrameIndexVirtualScavenging = TRI->requiresFrameIndexScavenging(MF);
- FrameIndexEliminationScavenging = (RS && !FrameIndexVirtualScavenging) ||
- TRI->requiresFrameIndexReplacementScavenging(MF);
ORE = &getAnalysis<MachineOptimizationRemarkEmitterPass>().getORE();
// Calculate the MaxCallFrameSize and AdjustsStack variables for the
@@ -1074,8 +1072,16 @@ void PEI::insertPrologEpilogCode(Machine
/// replaceFrameIndices - Replace all MO_FrameIndex operands with physical
/// register references and actual offsets.
void PEI::replaceFrameIndices(MachineFunction &MF) {
- const TargetFrameLowering &TFI = *MF.getSubtarget().getFrameLowering();
- if (!TFI.needsFrameIndexResolution(MF)) return;
+ const auto &ST = MF.getSubtarget();
+ const TargetFrameLowering &TFI = *ST.getFrameLowering();
+ if (!TFI.needsFrameIndexResolution(MF))
+ return;
+
+ const TargetRegisterInfo *TRI = ST.getRegisterInfo();
+
+ // Allow the target to determine this after knowing the frame size.
+ FrameIndexEliminationScavenging = (RS && !FrameIndexVirtualScavenging) ||
+ TRI->requiresFrameIndexReplacementScavenging(MF);
// Store SPAdj at exit of a basic block.
SmallVector<int, 8> SPState;
More information about the llvm-commits
mailing list