[AMDGPU] Trim zero components from buffer and image stores
authorMateja Marjanovic <mmarjano@amd.com>
Fri, 2 Jun 2023 13:41:15 +0000 (15:41 +0200)
committerMateja Marjanovic <mmarjano@amd.com>
Mon, 5 Jun 2023 10:30:21 +0000 (12:30 +0200)
commit88421ea973916e60c34beb26597a5fc33f83dd8f
tree90a26e1a7e48fd784823ecce9b73c01ce2684c06
parent9912bcc8ec75b7140db31d4b52a002e4be951b83
[AMDGPU] Trim zero components from buffer and image stores

For image and buffer stores the default behaviour on GFX11 and
older is to set all unset components to zero. So if we pass
only X component it will be the same as X000, or XY same as XY00.

This patch simplifies the passed vector of components in InstCombine
by removing zero components from the end.

For image stores it also trims DMask if necessary.

Reviewed by: arsenm, foad, nhaehnle, piotr
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-simplify-image-buffer-stores.ll [new file with mode: 0644]