[llvm] [AMDGPU] SIFoldOperands check that shrunk op is valid (PR #156298)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 01:33:39 PDT 2025


jayfoad wrote:

> > A possible alternative fix is to implement this TODO, so that the operand is legal for the e64 instruction so this code won't even try to shrink it:
> > https://github.com/llvm/llvm-project/blob/be1e50f56af8e270a0396eef8f62626fbbb84996/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp#L133
> 
> If that was done - would it make sense to keep the check anyway? Without it, the shrink code is by-passing checks.

If that was done then we could probably replace the check with an assert, on the grounds that every supported target either has an e32 encoding of V_ADD_CO_U32 or it supports VOP3 literals.

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


More information about the llvm-commits mailing list