[PATCH] D74466: [mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.
Alex Zinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 12 06:14:02 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfd11cda2519f: [mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm… (authored by poechsel, committed by ftynse).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74466/new/
https://reviews.llvm.org/D74466
Files:
mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
mlir/test/Conversion/StandardToLLVM/invalid.mlir
Index: mlir/test/Conversion/StandardToLLVM/invalid.mlir
===================================================================
--- /dev/null
+++ mlir/test/Conversion/StandardToLLVM/invalid.mlir
@@ -0,0 +1,13 @@
+// RUN: mlir-opt %s -verify-diagnostics -split-input-file
+
+#map1 = affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s1 + s0 + d1 * s2)>
+
+func @invalid_memref_cast(%arg0: memref<?x?xf64>) {
+ %c1 = constant 1 : index
+ %c0 = constant 0 : index
+ // expected-error at +1: 'std.memref_cast' op operand #0 must be unranked.memref of any type values or memref of any type values,
+ %5 = memref_cast %arg0 : memref<?x?xf64> to memref<?x?xf64, #map1>
+ %25 = std.subview %5[%c0, %c0][%c1, %c1][] : memref<?x?xf64, #map1> to memref<?x?xf64, #map1>
+ return
+}
+
Index: mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
===================================================================
--- mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
+++ mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
@@ -385,7 +385,8 @@
/*============================================================================*/
StructBuilder::StructBuilder(Value v) : value(v) {
assert(value != nullptr && "value cannot be null");
- structType = value.getType().cast<LLVM::LLVMType>();
+ structType = value.getType().dyn_cast<LLVM::LLVMType>();
+ assert(structType && "expected llvm type");
}
Value StructBuilder::extractPtr(OpBuilder &builder, Location loc,
@@ -2303,6 +2304,8 @@
return matchFailure();
// Create the descriptor.
+ if (!operands.front().getType().isa<LLVM::LLVMType>())
+ return matchFailure();
MemRefDescriptor sourceMemRef(operands.front());
auto targetMemRef = MemRefDescriptor::undef(rewriter, loc, targetDescTy);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74466.244156.patch
Type: text/x-patch
Size: 1782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200212/efc97624/attachment.bin>
More information about the llvm-commits
mailing list