AMDGPU/GlobalISel: Fix selection of image intrinsics with unused return
authorPetar Avramovic <Petar.Avramovic@amd.com>
Wed, 28 Apr 2021 11:11:44 +0000 (13:11 +0200)
committerPetar Avramovic <Petar.Avramovic@amd.com>
Thu, 29 Apr 2021 18:56:03 +0000 (20:56 +0200)
commitc34900e1335d490bf6f16fba55eacd4ecf831f72
treedc2f5e133bf6c47aea5e0c4bf0f1cdfe70b30007
parent2d42b2ee7bafe76d6b2c792b73f7371cb1cf8d94
AMDGPU/GlobalISel: Fix selection of image intrinsics with unused return

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.

Differential Revision: https://reviews.llvm.org/D101448
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.atomic.dim.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.atomic.dim.mir [new file with mode: 0644]