This is an archive of the discontinued LLVM Phabricator instance.

R600/SI: Fix bug in VGPR spilling
ClosedPublic

Authored by tstellarAMD on May 7 2015, 3:23 PM.

Details

Summary

AMDGPU::SI_SPILL_V96_RESTORE was missing from a switch statement, which caused the srsrc and soffset register to not be set correctly.

This commit replaces the switch statement with a SITargetInfo query to make sure all spill instructions are covered.

Diff Detail

Repository
rL LLVM

Event Timeline

tstellarAMD retitled this revision from to R600/SI: Fix bug in VGPR spilling.
tstellarAMD updated this object.
tstellarAMD edited the test plan for this revision. (Show Details)
tstellarAMD added a reviewer: arsenm.
tstellarAMD set the repository for this revision to rL LLVM.
tstellarAMD added a subscriber: Unknown Object (MLST).
arsenm accepted this revision.May 8 2015, 1:44 PM
arsenm edited edge metadata.

LGTM, although it could use a test

This revision is now accepted and ready to land.May 8 2015, 1:44 PM

The only test case I can get for this is too big and very fragile. The problem is that this bug fixes a spill of a VGPR96 register. The only way to create a def of a VGPR96 register is to have an image sample instruction whose only uses in the same block are either extract_element or a machine instruction. Compiling at -O2, the backend will select the VGPR96 image sample and then later on sink the extract elements, which gives us a VGPR96 live out that we could normally force spill by compiling with -O0. However, at -O0 the extract elements do not get sunk, so we end up spilling 3 32-bit values instead.

This revision was automatically updated to reflect the committed changes.