[ODS] Quick fix

Quick fix for a failing test in https://reviews.llvm.org/rG5267ed05bc4612e91409d63b4dbc4e01751acb75

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D155637
This commit is contained in:
Amanda Tang
2023-07-18 20:34:08 +00:00
parent 48e93f57f1
commit 729ffb5cdf

View File

@@ -918,14 +918,12 @@ LogicalResult mlir::shape::ConstShapeOp::inferReturnTypes(
MLIRContext *context, std::optional<Location> location,
ConstShapeOp::Adaptor adaptor, SmallVectorImpl<Type> &inferredReturnTypes) {
Builder b(context);
const Properties *prop = &adaptor.getProperties();
const Properties prop = adaptor.getProperties();
DenseIntElementsAttr shape;
// TODO: this is only exercised by the Python bindings codepath which does not
// support properties
if (prop)
shape = prop->shape;
else
shape = adaptor.getAttributes().getAs<DenseIntElementsAttr>("shape");
shape = prop.shape ? prop.shape :
adaptor.getAttributes().getAs<DenseIntElementsAttr>("shape");
if (!shape)
return emitOptionalError(location, "missing shape attribute");
inferredReturnTypes.assign({RankedTensorType::get(