@@ -247,12 +247,19 @@ LogicalResult emitc::AssignOp::verify() {
247
247
bool CastOp::areCastCompatible (TypeRange inputs, TypeRange outputs) {
248
248
Type input = inputs.front (), output = outputs.front ();
249
249
250
- return ((emitc::isIntegerIndexOrOpaqueType (input) ||
251
- emitc::isSupportedFloatType (input) ||
252
- isa<emitc::PointerType>(input) || isa<emitc::ArrayType>(input)) &&
253
- (emitc::isIntegerIndexOrOpaqueType (output) ||
254
- emitc::isSupportedFloatType (output) ||
255
- isa<emitc::PointerType>(output)));
250
+ if (auto arrayType = dyn_cast<emitc::ArrayType>(input)) {
251
+ if (auto pointerType = dyn_cast<emitc::PointerType>(output)) {
252
+ return (arrayType.getElementType () == pointerType.getPointee ()) &&
253
+ arrayType.getShape ().size () == 1 && arrayType.getShape ()[0 ] >= 1 ;
254
+ }
255
+ return false ;
256
+ }
257
+
258
+ return (
259
+ (emitc::isIntegerIndexOrOpaqueType (input) ||
260
+ emitc::isSupportedFloatType (input) || isa<emitc::PointerType>(input)) &&
261
+ (emitc::isIntegerIndexOrOpaqueType (output) ||
262
+ emitc::isSupportedFloatType (output) || isa<emitc::PointerType>(output)));
256
263
}
257
264
258
265
// ===----------------------------------------------------------------------===//
@@ -700,9 +707,9 @@ void IfOp::print(OpAsmPrinter &p) {
700
707
701
708
// / Given the region at `index`, or the parent operation if `index` is None,
702
709
// / return the successor regions. These are the regions that may be selected
703
- // / during the flow of control. `operands` is a set of optional attributes that
704
- // / correspond to a constant value for each operand, or null if that operand is
705
- // / not a constant.
710
+ // / during the flow of control. `operands` is a set of optional attributes
711
+ // / that correspond to a constant value for each operand, or null if that
712
+ // / operand is not a constant.
706
713
void IfOp::getSuccessorRegions (RegionBranchPoint point,
707
714
SmallVectorImpl<RegionSuccessor> ®ions) {
708
715
// The `then` and the `else` region branch back to the parent operation.
@@ -1000,8 +1007,8 @@ emitc::ArrayType::cloneWith(std::optional<ArrayRef<int64_t>> shape,
1000
1007
LogicalResult mlir::emitc::LValueType::verify (
1001
1008
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
1002
1009
mlir::Type value) {
1003
- // Check that the wrapped type is valid. This especially forbids nested lvalue
1004
- // types.
1010
+ // Check that the wrapped type is valid. This especially forbids nested
1011
+ // lvalue types.
1005
1012
if (!isSupportedEmitCType (value))
1006
1013
return emitError ()
1007
1014
<< " !emitc.lvalue must wrap supported emitc type, but got " << value;
0 commit comments