[llvm] [AMDGPU] Fix combineMasks dropping condition (PR #203180)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 22:11:55 PDT 2026


================
@@ -607,15 +607,24 @@ void SILowerControlFlow::combineMasks(MachineInstr &MI) {
   findMaskOperands(MI, 2, Ops);
   if (Ops.size() != 3) return;
 
-  unsigned UniqueOpndIdx;
-  if (Ops[0].isIdenticalTo(Ops[1])) UniqueOpndIdx = 2;
-  else if (Ops[0].isIdenticalTo(Ops[2])) UniqueOpndIdx = 1;
-  else if (Ops[1].isIdenticalTo(Ops[2])) UniqueOpndIdx = 1;
-  else return;
+  // Ops holds the exec operand and the two operands of the nested op.
+  // Always keep a nested operand, never the exec operand.
+  unsigned ExecIdx = OpToReplace == 1 ? 2 : 0;
+  unsigned NestedLHS = OpToReplace == 1 ? 0 : 1;
----------------
aobolensk wrote:

done

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


More information about the llvm-commits mailing list