This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Correct the setting of `FlatScratchInit`.
ClosedPublic

Authored by hliao on Jul 3 2019, 10:18 AM.

Event Timeline

hliao created this revision.Jul 3 2019, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2019, 10:18 AM
hliao added a comment.Jul 3 2019, 10:20 AM

FlatScratchInit is set by checking whether there are any stack objects in the early stage of codegen. As we could load MIR in any stage, even after RA, it may set that flag incorrectly by counting spilling stack slot.

hliao marked an inline comment as done.Jul 3 2019, 10:24 AM
hliao added inline comments.
llvm/test/CodeGen/AMDGPU/undefined-physreg-sgpr-spill.mir
44

this test case needs revising as the max-sgprs is incorrectly calculated when FlatScratchInit is set wrongly. That results in $sgpr10 and sgpr11 being reserved. After fixing FlatScratchInit setting, we need to add them into livein registers.

arsenm accepted this revision.Jul 3 2019, 7:42 PM

LGTM

This revision is now accepted and ready to land.Jul 3 2019, 7:42 PM
This revision was automatically updated to reflect the committed changes.