[AMDGPU] Allow hoisting of some VALU compare instructions
authorCarl Ritson <carl.ritson@amd.com>
Tue, 8 Feb 2022 02:27:23 +0000 (11:27 +0900)
committerCarl Ritson <carl.ritson@amd.com>
Tue, 8 Feb 2022 02:27:23 +0000 (11:27 +0900)
commita1fb307b4b8d5ffd8f66a477783e362e54a3c03c
tree1c7aecc30ab12cc392bba5000a8d94ade3e68947
parentdd101c808b85aad8edb48ab6d5f754cc6527fcff
[AMDGPU] Allow hoisting of some VALU compare instructions

Conversatively allow hoisting/sinking of VALU comparisons.
If the result of a comparison is masked with exec, narrowing the
set of active lanes, then it is safe to hoist it as the masking
instruction will never by hoisted.

Heuristically this is also true for sinking, as we do not expect
the result of a sunk comparison that is masked with exec to be
used outside of the loop.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D118975
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/test/CodeGen/AMDGPU/licm-valu.mir