#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Transforms/DialectConversion.h"
+#include "llvm/Support/FormatVariadic.h"
using namespace mlir;
SmallVector<Type, 8> returnTypes;
for (auto result : ifOp.getResults()) {
auto convertedType = typeConverter.convertType(result.getType());
+ if (!convertedType)
+ return failure();
+
+
returnTypes.push_back(convertedType);
}
replaceSCFOutputValue(ifOp, selectionOp, rewriter, scfToSPIRVContext,
return
}
+// Memrefs without a spirv storage class are not supported. The conversion
+// should preserve the `scf.if` and not crash.
+func.func @unsupported_yield_type(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %c : i1) {
+// CHECK-LABEL: @unsupported_yield_type
+// CHECK-NEXT: scf.if
+// CHECK: spirv.Return
+ %r = scf.if %c -> (memref<8xi32>) {
+ scf.yield %arg0 : memref<8xi32>
+ } else {
+ scf.yield %arg1 : memref<8xi32>
+ }
+ return
+}
+
} // end module