[Mlir-commits] [mlir] [mlir][memref] Fix segfault in SROA. (PR	#71063)
    Mehdi Amini 
    llvmlistbot at llvm.org
       
    Thu Nov  2 16:24:48 PDT 2023
    
    
  
================
@@ -187,14 +187,28 @@ DeletionKind memref::LoadOp::removeBlockingUses(
   return DeletionKind::Delete;
 }
 
-/// Returns the index of a memref in attribute form, given its indices.
+/// Returns the index of a memref in attribute form, given its indices. Returns
+/// a null pointer if whether the indices form a valid index for the provided
+/// MemRefType cannot be computed.
 static Attribute getAttributeIndexFromIndexOperands(MLIRContext *ctx,
-                                                    ValueRange indices) {
+                                                    ValueRange indices,
+                                                    MemRefType memrefType) {
+  ArrayRef<int64_t> shape = memrefType.getShape();
+  if (indices.size() != memrefType.getShape().size())
----------------
joker-eph wrote:
```suggestion
  if (indices.size() != shape.size())
```
https://github.com/llvm/llvm-project/pull/71063
    
    
More information about the Mlir-commits
mailing list