[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 13:53:11 PDT 2024


================
@@ -1778,10 +1778,9 @@ 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",
+    if (IndexOp.getImm() % DstTy.getElementCount().getKnownMinValue() != 0) {
----------------
topperc wrote:

Please add the equivalent of this from the IR verifier

```
    // If this extraction is not the 'mixed' case where a fixed vector is        
    // extracted from a scalable vector, ensure that the extraction does not     
    // overrun the parent vector.                                                
    if (VecEC.isScalable() == ResultEC.isScalable()) {                           
      Check(IdxN < VecEC.getKnownMinValue() &&                                   
                IdxN + ResultEC.getKnownMinValue() <= VecEC.getKnownMinValue(),  
            "vector_extract would overrun.");                                    
    }  
```

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


More information about the llvm-commits mailing list