[llvm] [AMDGPU] Switch V_CNDMASK operands to shrink it into VOP2 (PR #135162)

Ana Mihajlovic via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 06:39:22 PDT 2025


================
@@ -973,6 +1083,10 @@ bool SIShrinkInstructions::run(MachineFunction &MF) {
         continue;
       }
 
+      if (MI.getOpcode() == AMDGPU::V_CNDMASK_B32_e64 &&
----------------
mihajlovicana wrote:

> I still find it quite confusing how you use OldVCC and NewVCC to track state.
> 
> Do you think it might be simpler to drive this all from the compare instruction instead, like:
> 
> ```
>   if (isVOPC(MI) && ...) {
>     invert the compare in-place and swap the operands of all its users in-place
>   }
> ```

I can't swap operands on all uses at once because it will corrupt the iterator

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


More information about the llvm-commits mailing list