[PATCH] D48165: InstCombine/AMDGPU: Add dimension-aware image intrinsics to SimplifyDemanded

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 06:18:32 PDT 2018


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, rampitec, majnemer.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, mgorny, wdng, kzhuravl.

Use the expanded features of the TableGen generic tables to avoid manually
adding the combinatorially exploded set of intrinsics. The
getAMDGPUImageDimIntrinsic lookup function is early-out,
i.e. non-AMDGPU intrinsics will never look at the underlying table.

Use a generic approach for getting the new intrinsic overload to keep the
code simple, and make the image dmask handling more generic:

- handle non-sampler image loads
- handle the case where the set of demanded elements is not a prefix

There is some overlap between this code and an optimization that happens
in the backend during code generation. They currently complement each other:

- only the codegen optimization can generate vec3 loads
- only the InstCombine optimization can handle https://reviews.llvm.org/D16

The InstCombine optimization also likely covers more cases since the
codegen optimization is fairly ad-hoc. Ideally, we'll remove the optimization
in codegen once the infrastructure for vec3 is in place (which will probably
take a long time).

Modify the test cases to use dimension-aware intrinsics. This makes it
easier to see that the test coverage for the new intrinsics is equivalent,
and the old style intrinsics will be removed in a follow-up commit anyway.

Change-Id: I4b91ea661413d13004956fe4ef7d13d41b8ce3ad


Repository:
  rL LLVM

https://reviews.llvm.org/D48165

Files:
  include/llvm/IR/IntrinsicsAMDGPU.td
  lib/Transforms/InstCombine/CMakeLists.txt
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  lib/Transforms/InstCombine/InstCombineTables.td
  test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48165.151337.patch
Type: text/x-patch
Size: 159474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180614/61283162/attachment.bin>


More information about the llvm-commits mailing list