[Mlir-commits] [mlir] 729ffb5 - [ODS] Quick fix

Amanda Tang llvmlistbot at llvm.org
Tue Jul 18 13:44:19 PDT 2023


Author: Amanda Tang
Date: 2023-07-18T20:44:14Z
New Revision: 729ffb5cdf3ee09e8e89cdd122084a9563ee0717

URL: https://github.com/llvm/llvm-project/commit/729ffb5cdf3ee09e8e89cdd122084a9563ee0717
DIFF: https://github.com/llvm/llvm-project/commit/729ffb5cdf3ee09e8e89cdd122084a9563ee0717.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index a06dd446e258a4..1c529929a401d2 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -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(


        


More information about the Mlir-commits mailing list