[PATCH] D89170: [AMDGPU] Select flat scratch instructions where available
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 10:51:45 PDT 2020
rampitec added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:482
if (MFI->hasFlatScratchInit()) {
emitEntryFunctionFlatScratchInit(MF, MBB, I, DL, ScratchWaveOffsetReg);
----------------
Flakebi wrote:
> Should this be `MFI->hasFlatScratchInit() || (ST.enableFlatScratch() && requiresStackPointerReference(MF))`?
> Otherwise, the scratch does not get initialized (I guess it’s fine to do that in a later patch).
Do you see it not initialized? In the SIMachineFunctionInfo() there is this code:
```
if (ST.hasFlatAddressSpace() && isEntryFunction() && isAmdHsaOrMesa) {
// TODO: This could be refined a lot. The attribute is a poor way of
// detecting calls or stack objects that may require it before argument
// lowering.
if (HasCalls || HasStackObjects)
FlatScratchInit = true;
}
```
So I assume it has to be initialized. Probably the culprit is this isAmdHsaOrMesa condition? It may be needed to say (isAmdHsaOrMesa || ST.enableFlatScratch()) instead. For some reason this code is not executed for amdpal, I do not see an obvious reason why.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89170/new/
https://reviews.llvm.org/D89170
More information about the llvm-commits
mailing list