[llvm] [RISCV] Fold vmnot.m of an integer compare into the compare (PR #222553)

Marton Moro via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 00:14:32 PDT 2026


================
@@ -19560,6 +19253,29 @@ static SDValue performORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
   return combineSelectAndUseCommutative(N, DAG, /*AllOnes*/ false, Subtarget);
 }
 
+// Fold (vmxor_vl (setcc_vl a, b, cc), vmset_vl) -> (setcc_vl a, b, !cc) for
+// integer compares. The NOT also flips the masked-off lanes, which the inverted
+// compare copies unchanged from the passthru. So the passthru must be undef,
+// but any mask is fine.
+static SDValue combineVMNOTOfSetCC(SDNode *N, SelectionDAG &DAG) {
+  SDValue Cmp = N->getOperand(0);
+  if (Cmp.getOpcode() == RISCVISD::VMSET_VL)
+    Cmp = N->getOperand(1);
+  else if (N->getOperand(1).getOpcode() != RISCVISD::VMSET_VL)
+    return SDValue();
----------------
martonmoro wrote:

Thanks, applied the change

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


More information about the llvm-commits mailing list