[llvm] [GISel] Improve MachineVerifier for G_SCMP/UCMP. (PR #120017)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 15 12:53:23 PST 2024


================
@@ -1627,18 +1626,18 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
       break;
     }
 
+    if (DstTy.getScalarSizeInBits() < 2) {
+      report("result type must be at least 2 bits wide", MI);
+      break;
+    }
+
     if ((DstTy.isVector() != SrcTy.isVector()) ||
         (DstTy.isVector() &&
          DstTy.getElementCount() != SrcTy.getElementCount())) {
       report("Generic vector scmp/ucmp must preserve number of lanes", MI);
       break;
     }
----------------
s-barannikov wrote:

Don't mind me. G_ABDS/G_ABDU have the same type for result/operands, G_UCMP/G_SCMP don't and therefore require the check.


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


More information about the llvm-commits mailing list