[PATCH] D73429: [mlir][NFC] Update Operation::getResultTypes to use ArrayRef<Type> instead of iterator_range.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 26 09:38:34 PST 2020


rriddle marked 4 inline comments as done.
rriddle added inline comments.


================
Comment at: mlir/include/mlir/IR/Operation.h:266
+  result_type_iterator result_type_end() { return getResultTypes().end(); }
+  result_type_range getResultTypes();
 
----------------
bondhugula wrote:
> Nit: result_type_range -> ArrayRef<Type>
> 
> result_type_range has only one use.
It is used in other places, e.g. in multi-result operations. I'd rather not remove at it is consistent with the rest of the ranges.


================
Comment at: mlir/test/lib/TestDialect/TestPatterns.cpp:257
     // If the type is F32, change the type to F64.
-    if (!(*op->result_type_begin()).isF32())
+    if (!Type(*op->result_type_begin()).isF32())
       return matchFailure();
----------------
bondhugula wrote:
> This pattern looks like a concern. Do we get a warning if we didn't use the Type ctor? It's not clear to me why we need it now. 
It is necessary because the methods on Type are non-const and the result type range now returns  `const Type` elements, instead of a `Type`. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73429/new/

https://reviews.llvm.org/D73429





More information about the llvm-commits mailing list