[llvm-branch-commits] [llvm] [AMDGPU][GlobalISel] Add COPY_SCC_VCC combine for VCC-SGPR-VGPR pattern (PR #179352)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 24 00:43:27 PST 2026


vangthao95 wrote:

> To get back to one of the questions, quoted combine should be considered for pretty much **all** opcodes (maybe some checks are needed but usually if there is SALU version, there is also VALU version of same instruction)
> 
> Description needs to be clarified a bit, this is `"move sgpr g_select to VALU" if one of the inputs is COPY_SCC_VCC`. Not sure if you want to merge the select first and do generic case in another PR or are you updating this one. Try adding .ll tests with different number of COPY_SCC_VCC or G_READANYLANE inputs to se if we can get some heuristic go get this going. I assume good start would be to count instructions that would be deleted, v_mov that would be added (COPY to vgpr at this point) and ignore v_mov of constant or similar if we could predict that they would be inlined later

I think the goal here is to merge the select first. However, looking at the new *.ll test, I can see that this combine does not help much besides sext/zext cases. At most it eliminates one instruction and in worst case can generate up to two v_mov if select has sgpr inputs.

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


More information about the llvm-branch-commits mailing list