[Mlir-commits] [mlir] [mlir][TilingInterface] NFC code changes separated out from introduction of `scf::tileUsingSCFForallop`. (PR #67081)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 25 16:47:51 PDT 2023


================
@@ -55,6 +55,30 @@ fillInterchangeVector(ArrayRef<int64_t> interchangeVector,
   return filledVector;
 }
 
+/// Convert a list of ops of type `SrcOpTy` to list of `Operation *`.
+template <typename SrcOpTy>
+static SmallVector<Operation *> getAsOperations(ArrayRef<SrcOpTy> ops) {
+  return llvm::to_vector(
+      llvm::map_range(ops, [](auto op) -> Operation * { return op; }));
+}
+template <typename SrcOpTy>
+static SmallVector<Operation *>
+getAsOperations(const SmallVector<SrcOpTy> &ops) {
+  return getAsOperations(ArrayRef<SrcOpTy>(ops));
+}
+
+/// Convert a list of `Operation *` to a list of `DstOpTy`
+template <typename DstOpTy>
+static SmallVector<DstOpTy> castToTypedOperations(ArrayRef<Operation *> ops) {
----------------
MaheshRavishankar wrote:

These are the mirror of the ones above. Makes it easier to follow the code later on. I am going to leave it there for now?

https://github.com/llvm/llvm-project/pull/67081


More information about the Mlir-commits mailing list