This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: SGPR accounting in getSIProgramInfo must ignore exec_lo/hi
ClosedPublic

Authored by nhaehnle on Apr 17 2016, 11:55 AM.

Details

Summary

A shader stored the live mask (initial exec mask) in an SGPR which was then
spilled during register allocation. The allocator quite reasonably
optimized turned the spill into

v_writelane_b32 %vgpr, exec_lo, N
v_writelane_b32 %vgpr, exec_hi, N+1

at the beginning of the shader, confusing the SGPR accounting.

No test case, because si-sgpr-spill.ll together with an upcoming patch for
WQM handling exhibits the problem.

Diff Detail

Repository
rL LLVM

Event Timeline

nhaehnle updated this revision to Diff 54008.Apr 17 2016, 11:55 AM
nhaehnle retitled this revision from to AMDGPU/SI: SGPR accounting in getSIProgramInfo must ignore exec_lo/hi.
nhaehnle updated this object.
nhaehnle added reviewers: arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
arsenm accepted this revision.Apr 17 2016, 12:58 PM
arsenm edited edge metadata.

LGTM. Although we should be able to remove finding the number of used registers this way, and can use the register info queries like is done in FrameLowering already

This revision is now accepted and ready to land.Apr 17 2016, 12:58 PM
This revision was automatically updated to reflect the committed changes.