This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] We would need FP if there is call and caller save VGPR spills
ClosedPublic

Authored by RamNalamothu on Jul 24 2021, 2:11 PM.

Details

Summary

Since https://reviews.llvm.org/D98319, determineCalleeSavesSGPR() needs
to consider caller save VGPR spills as well while anticipating if we
require FP.

Fixes: SWDEV-295978

Diff Detail

Event Timeline

RamNalamothu created this revision.Jul 24 2021, 2:11 PM
RamNalamothu requested review of this revision.Jul 24 2021, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2021, 2:11 PM

LGTM except the test is using dead code. I also think we ought to be able to remove VGPRReservedForSGPRSpill now that SGPR and VGPR allocation are split

llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
1310

Checking TRI->spillSGPRToVGPR() should be redundant

llvm/test/CodeGen/AMDGPU/need-fp-from-caller-save-vgpr-spill.ll
17

The cast/alloca are dead

51–52

The cast/alloca are dead

90–91

The cast/alloca are dead

RamNalamothu edited the summary of this revision. (Show Details)

Address review comments.

RamNalamothu marked 3 inline comments as done.Jul 27 2021, 4:44 AM

LGTM except the test is using dead code. I also think we ought to be able to remove VGPRReservedForSGPRSpill now that SGPR and VGPR allocation are split

I think that's out of the scope for this review.

LGTM except the test is using dead code. I also think we ought to be able to remove VGPRReservedForSGPRSpill now that SGPR and VGPR allocation are split

I think that's out of the scope for this review.

Yes, but would be a good follow up change.

This test looks nearly identical to test/CodeGen/AMDGPU/need-fp-from-csr-vgpr-spill.ll. Can the two be merged? I don't actually see why the existing test didn't catch this and isn't changed

LGTM except the test is using dead code. I also think we ought to be able to remove VGPRReservedForSGPRSpill now that SGPR and VGPR allocation are split

I think that's out of the scope for this review.

Yes, but would be a good follow up change.

This test looks nearly identical to test/CodeGen/AMDGPU/need-fp-from-csr-vgpr-spill.ll. Can the two be merged? I don't actually see why the existing test didn't catch this and isn't changed.

Because test/CodeGen/AMDGPU/need-fp-from-csr-vgpr-spill.ll covers the path where we have only CSR VGPR spills and llvm/test/CodeGen/AMDGPU/need-fp-from-caller-save-vgpr-spill.ll covers the other scenario where we might reserve a caller save VGPR for SGPR spill.

Will merge both tests/files into test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll.

Merged test/CodeGen/AMDGPU/need-fp-from-csr-vgpr-spill.ll and llvm/test/CodeGen/AMDGPU/need-fp-from-caller-save-vgpr-spill.ll into test/CodeGen/AMDGPU/need-fp-from-vgpr-spills.ll.

LGTM except the test is using dead code. I also think we ought to be able to remove VGPRReservedForSGPRSpill now that SGPR and VGPR allocation are split

I think that's out of the scope for this review.

Yes, but would be a good follow up change.

OK, will try that.

RamNalamothu marked an inline comment as done.Jul 27 2021, 11:30 AM
arsenm accepted this revision.Jul 27 2021, 7:23 PM
This revision is now accepted and ready to land.Jul 27 2021, 7:23 PM
This revision was landed with ongoing or failed builds.Jul 27 2021, 10:43 PM
This revision was automatically updated to reflect the committed changes.