[Mlir-commits] [mlir] [mlir][spirv][cf] Check destination block argument types (PR #70889)

Jakub Kuderski llvmlistbot at llvm.org
Wed Nov 1 21:34:36 PDT 2023


================
@@ -18,43 +18,73 @@
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 #include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
 #include "mlir/IR/AffineMap.h"
+#include "mlir/IR/PatternMatch.h"
 #include "mlir/Support/LogicalResult.h"
+#include "mlir/Transforms/DialectConversion.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/FormatVariadic.h"
 
 #define DEBUG_TYPE "cf-to-spirv-pattern"
 
 using namespace mlir;
 
+/// Checks that the target block arguments are legal.
+static LogicalResult checkBlockArguments(Block &block, Operation *op,
+                                         PatternRewriter &rewriter,
+                                         const TypeConverter &converter) {
+  for (BlockArgument arg : block.getArguments()) {
----------------
kuhar wrote:

I think it's about the same amount of typing here because we can't pass 'isLegal' as the function argument and would have to write a lambda with the same condition as the `if` below. Either would be fine, so I'm going to land as-is

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


More information about the Mlir-commits mailing list