File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -354,7 +354,6 @@ LogicalResult PtrAddOp::inferReturnTypes(
354354 Type baseType = operands[0 ].getType ();
355355 Type offsetType = operands[1 ].getType ();
356356
357- // If neither are shaped types, result is same as base type.
358357 auto offTy = dyn_cast<ShapedType>(offsetType);
359358 if (!offTy) {
360359 // If the offset isn't shaped, the result is always the base type.
@@ -363,9 +362,10 @@ LogicalResult PtrAddOp::inferReturnTypes(
363362 }
364363 auto baseTy = dyn_cast<ShapedType>(baseType);
365364 if (!baseTy) {
366- // Base isn't shaped, but offset is, use the ShapedType from offset with the base pointer as element type.
367- inferredReturnTypes.push_back (offsetShapedType.clone (baseType));
368- return success ();
365+ // Base isn't shaped, but offset is, use the ShapedType from offset with the
366+ // base pointer as element type.
367+ inferredReturnTypes.push_back (offTy.clone (baseType));
368+ return success ();
369369 }
370370
371371 // Both are shaped, their shape must match.
@@ -374,6 +374,7 @@ LogicalResult PtrAddOp::inferReturnTypes(
374374 mlir::emitError (*location) << " shapes of base and offset must match" ;
375375 return failure ();
376376 }
377+
377378 // Make sure they are the same kind of shaped type.
378379 if (baseType.getTypeID () != offsetType.getTypeID ()) {
379380 if (location)
You can’t perform that action at this time.
0 commit comments