[llvm] [AMDGPU] Prevent SDWA 'preserve' transformation for instructions in different basic blocks. (PR #82406)

Valery Pykhtin via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 06:53:33 PST 2024


vpykhtin wrote:

> I think it should be fine. This happens before control flow lowering, so exec mask changes are not explicit in the MIR anyway.

I'm trying to understand why it would be valid.

%v0:vgpr_32 = sdwa1 .. dst_sel: WORD0 unused_pad
%v1:vgpr_32 = sdwa2 .. dst_sel: WORD1 unused_pad

if (...) {
   $v2:vgpr_32 = V_OR_B32 %v0, %v1
   use %v2
}

So this would be valid because 'if' only narrows the execmask and we cannot have uninitialized values in %v0, %v1 at some lanes inside 'then' bb. I probably cannot imagine situation when execmask at 'then' BB isn't a subset of execmasks from BBs for sdwa1 and sdwa2 instructions.






https://github.com/llvm/llvm-project/pull/82406


More information about the llvm-commits mailing list