The type printer was ignoring the memory space on unranked memrefs.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86096
.Case<UnrankedMemRefType>([&](UnrankedMemRefType memrefTy) {
os << "memref<*x";
printType(memrefTy.getElementType());
+ // Only print the memory space if it is the non-default one.
+ if (memrefTy.getMemorySpace())
+ os << ", " << memrefTy.getMemorySpace();
os << '>';
})
.Case<ComplexType>([&](ComplexType complexTy) {
return
}
+// Check that unranked memrefs with non-default memory space roundtrip
+// properly.
+// CHECK-LABEL: @unranked_memref_roundtrip(memref<*xf32, 4>)
+func @unranked_memref_roundtrip(memref<*xf32, 4>)
+
// CHECK-LABEL: func @memref_view(%arg0
func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) {
%0 = alloc() : memref<2048xi8>
// incompatible memory space
func @invalid_memref_cast() {
%0 = alloc() : memref<2x5xf32, 0>
- // expected-error@+1 {{operand type 'memref<2x5xf32>' and result type 'memref<*xf32>' are cast incompatible}}
+ // expected-error@+1 {{operand type 'memref<2x5xf32>' and result type 'memref<*xf32, 1>' are cast incompatible}}
%1 = memref_cast %0 : memref<2x5xf32, 0> to memref<*xf32, 1>
return
}