[llvm] [AMDGPU] Analyze subword loads in redundant AND deletion (PR #229926)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 08:05:16 PDT 2026
LU-JOHN wrote:
> This kind of stuff really should have been handled by IR pass or during legalization, why handle this here? The only real reason would it depends on cross-block folding in SelectionDAG, but you have a bunch of changed tests that are a single block
I can't think of a good way to handle this case during or before legalization:
```
%a = load i8, ptr addrspace(1) %in
%ext = zext i8 %a to i64
```
This gets legalized to:
```
t36: i16,ch = load<("amdgpu-noclobber" load (s8) from %ir.3, addrspace 1), zext from i8>
t37: i64 = zero_extend t36
```
Only after ISEL does the redundant AND appear:
```
%18:vgpr_32 = FLAT_LOAD_UBYTE killed %19, 0, 0, implicit $exec, implicit $flat_scr
:: ("amdgpu-noclobber" load (s8) from %ir.3, addrspace 1)
%20:sreg_32 = S_MOV_B32 65535
%28:vgpr_32 = V_AND_B32_e64 %18, killed %20, implicit $exec
```
https://github.com/llvm/llvm-project/pull/229926
More information about the llvm-commits
mailing list