[AMDGPU] Stop replacing amdgcn.ballot(1) with amdgcn.s.getreg(exec)
authorJay Foad <jay.foad@amd.com>
Thu, 15 Jun 2023 16:45:17 +0000 (17:45 +0100)
committerJay Foad <jay.foad@amd.com>
Fri, 16 Jun 2023 16:15:52 +0000 (17:15 +0100)
commit84313162bf79a4c16ad3edd2a2e6accad569a907
tree9630b29b648715ee68be46ad4c15891008ec4a41
parent82d330e0e04a55ee95dc93980761545a01543fde
[AMDGPU] Stop replacing amdgcn.ballot(1) with amdgcn.s.getreg(exec)

Rationale:
- It does not enable any further IR simplifications.
- It does not improve the generated code since the isel lowering of
  ballot also has special cases for 0 and 1.
- getreg is "too powerful" since it can read from many different
  registers, so its intrinsic properties have to be set very
  conservatively.

There is also a correctness problem that getreg can read from exec but
it is currently not marked as convergent.

Differential Revision: https://reviews.llvm.org/D153047
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll