[llvm] [GISEL] Fix bugs in G_EXTRACT_SUBVECTOR definition (PR #108848)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 15:34:45 PDT 2024


================
@@ -1778,10 +1778,20 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
       break;
     }
 
-    if (IndexOp.getImm() != 0 &&
-        SrcTy.getElementCount().getKnownMinValue() % IndexOp.getImm() != 0) {
-      report("Index must be a multiple of the source vector's minimum vector "
-             "length",
+    uint64_t Idx = IndexOp.getImm();
+    uint64_t DstMinLen = DstTy.getElementCount().getKnownMinValue();
+    if (Idx % DstMinLen != 0) {
+      report("Index must be a multiple of the destination vector's minimum "
+             "vector length",
+             MI);
+      break;
+    }
+
+    uint64_t SrcMinLen = SrcTy.getElementCount().getKnownMinValue();
+    if (SrcTy.isScalable() && DstTy.isScalable() &&
----------------
topperc wrote:

This applies for `!SrcTy.isScalable() && `DstTy.isScalable()` too.

The missing check is an independent check that `SrcTy.isScalable() == DstTy.isScalable()`.

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


More information about the llvm-commits mailing list