#include "mlir/IR/TypeUtilities.h"
#include "mlir/Target/LLVMIR/TypeToLLVM.h"
#include "mlir/Transforms/DialectConversion.h"
+#include "llvm/Support/Casting.h"
#include <optional>
using namespace mlir;
matchAndRewrite(vector::MaskOp maskOp, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override final {
// Match against the maskable operation kind.
- Operation *maskableOp = maskOp.getMaskableOp();
- if (!isa<MaskedOp>(maskableOp))
+ auto maskedOp = llvm::dyn_cast_or_null<MaskedOp>(maskOp.getMaskableOp());
+ if (!maskedOp)
return failure();
- return matchAndRewriteMaskableOp(
- maskOp, cast<MaskedOp>(maskOp.getMaskableOp()), rewriter);
+ return matchAndRewriteMaskableOp(maskOp, maskedOp, rewriter);
}
protected:
--- /dev/null
+// RUN: mlir-opt %s --gpu-to-llvm | FileCheck %s
+
+module {
+ func.func @func(%arg: vector<11xf32>) {
+ %cst_41 = arith.constant dense<true> : vector<11xi1>
+ // CHECK: vector.mask
+ // CHECK-SAME: vector.yield %arg0
+ %127 = vector.mask %cst_41 { vector.yield %arg : vector<11xf32> } : vector<11xi1> -> vector<11xf32>
+ return
+ }
+}