[ODS] Quick fix
authorAmanda Tang <amandatang@google.com>
Tue, 18 Jul 2023 20:34:08 +0000 (20:34 +0000)
committerAmanda Tang <amandatang@google.com>
Tue, 18 Jul 2023 20:44:14 +0000 (20:44 +0000)
Quick fix for a failing test in https://reviews.llvm.org/rG5267ed05bc4612e91409d63b4dbc4e01751acb75

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D155637

mlir/lib/Dialect/Shape/IR/Shape.cpp

index a06dd44..1c52992 100644 (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(