[clang] [mlir] [compiler-rt] [llvm] [libcxx] [clang-tools-extra] [flang] [mlir] Fix a zero stride canonicalizer crash (PR #74200)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 22:33:08 PST 2023


================
@@ -0,0 +1,14 @@
+// RUN: mlir-opt %s -inline -split-input-file | FileCheck %s
+
+// CHECK-LABEL: func @inline_negative_stride
+func.func @inline_negative_stride(%arg0 : memref<10xf32>) -> memref<1xf32, strided<[?], offset: 1>> {
+  cf.br ^bb1(%arg0 : memref<10xf32>)
+^bb1(%m: memref<10xf32>):
+  %c0 = arith.constant 0 : index
+  %c1 = arith.constant 1 : index
+  %1 = memref.subview %m[1] [1] [%c0] : memref<10xf32> to memref<1xf32, strided<[?], offset: 1>>
+  return %1 : memref<1xf32, strided<[?], offset: 1>>
+}
+// CHECK-NEXT: arith.constant 0 : index
+// CHECK-NEXT: %[[SUBVIEW:.*]] = memref.subview
+// CHECK-NEXT: return %[[SUBVIEW]] : memref<1xf32, strided<[?], offset: 1>>
----------------
joker-eph wrote:

This is a canonicalized crash, we don't need to run the inliner.

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


More information about the llvm-commits mailing list