This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Fix selection of image intrinsics with unused return
ClosedPublic

Authored by Petar.Avramovic on Apr 28 2021, 5:57 AM.

Details

Summary

When atomic image intrinsic return value is unused, register class for
destination of a sub-register copy of return value ends up not being set.
This copy then hits 'Register class not set' assert later.
If return value has uses, register class is determined by use instruction.
Fix is to not create sub-register copy when image intrinsic destination has
no uses because it would be deleted by dead-mi-elimination later anyway.

Diff Detail

Event Timeline

Petar.Avramovic requested review of this revision.Apr 28 2021, 5:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2021, 5:57 AM
arsenm accepted this revision.Apr 28 2021, 6:01 AM

LGTM. Letting the case where we do need the copy rely on the user constraining it is a bit iffy though

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
1651–1652

In principle this would need the result register to be constrained anyway

This revision is now accepted and ready to land.Apr 28 2021, 6:01 AM
This revision was landed with ongoing or failed builds.Apr 29 2021, 11:57 AM
This revision was automatically updated to reflect the committed changes.