@@ -305,6 +305,14 @@ LogicalResult emitc::AssignOp::verify() {
305305bool CastOp::areCastCompatible (TypeRange inputs, TypeRange outputs) {
306306 Type input = inputs.front (), output = outputs.front ();
307307
308+ if (auto arrayType = dyn_cast<emitc::ArrayType>(input)) {
309+ if (auto pointerType = dyn_cast<emitc::PointerType>(output)) {
310+ return (arrayType.getElementType () == pointerType.getPointee ()) &&
311+ arrayType.getShape ().size () == 1 && arrayType.getShape ()[0 ] >= 1 ;
312+ }
313+ return false ;
314+ }
315+
308316 return (
309317 (emitc::isIntegerIndexOrOpaqueType (input) ||
310318 emitc::isSupportedFloatType (input) || isa<emitc::PointerType>(input)) &&
@@ -757,9 +765,9 @@ void IfOp::print(OpAsmPrinter &p) {
757765
758766// / Given the region at `index`, or the parent operation if `index` is None,
759767// / return the successor regions. These are the regions that may be selected
760- // / during the flow of control. `operands` is a set of optional attributes that
761- // / correspond to a constant value for each operand, or null if that operand is
762- // / not a constant.
768+ // / during the flow of control. `operands` is a set of optional attributes
769+ // / that correspond to a constant value for each operand, or null if that
770+ // / operand is not a constant.
763771void IfOp::getSuccessorRegions (RegionBranchPoint point,
764772 SmallVectorImpl<RegionSuccessor> ®ions) {
765773 // The `then` and the `else` region branch back to the parent operation.
@@ -1086,8 +1094,8 @@ emitc::ArrayType::cloneWith(std::optional<ArrayRef<int64_t>> shape,
10861094LogicalResult mlir::emitc::LValueType::verify (
10871095 llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
10881096 mlir::Type value) {
1089- // Check that the wrapped type is valid. This especially forbids nested lvalue
1090- // types.
1097+ // Check that the wrapped type is valid. This especially forbids nested
1098+ // lvalue types.
10911099 if (!isSupportedEmitCType (value))
10921100 return emitError ()
10931101 << " !emitc.lvalue must wrap supported emitc type, but got " << value;
0 commit comments