From 4fd012cda215805a1fe34449fb7b28f6644842ba Mon Sep 17 00:00:00 2001 From: River Riddle Date: Thu, 30 May 2019 14:58:28 -0700 Subject: [PATCH] Replace a usage of std::vector with SmallVector to allow constructing with non-constant iterators on MSVC. -- PiperOrigin-RevId: 250769027 --- mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp | 8 +++----- mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp b/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp index cc0d7f9..2c06526 100644 --- a/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp +++ b/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp @@ -115,7 +115,7 @@ public: struct FunctionToSpecialize { mlir::Function *function; std::string mangledName; - std::vector argumentsType; + SmallVector argumentsType; }; void runOnModule() override { @@ -308,10 +308,8 @@ public: if (!mangledCallee) { // Can't find the target, this is where we queue the request for the // callee and stop the inference for the current function now. - std::vector funcArgs(op->operand_type_begin(), - op->operand_type_end()); - funcWorklist.push_back( - {callee, std::move(mangledName), std::move(funcArgs)}); + funcWorklist.push_back({callee, std::move(mangledName), + llvm::to_vector<4>(op->getOperandTypes())}); return mlir::success(); } // Found a specialized callee! Let's turn this into a normal call diff --git a/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp b/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp index 3bd5d26..c9da85f 100644 --- a/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp +++ b/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp @@ -115,7 +115,7 @@ public: struct FunctionToSpecialize { mlir::Function *function; std::string mangledName; - std::vector argumentsType; + SmallVector argumentsType; }; void runOnModule() override { @@ -312,10 +312,8 @@ public: if (!mangledCallee) { // Can't find the target, this is where we queue the request for the // callee and stop the inference for the current function now. - std::vector funcArgs(op->operand_type_begin(), - op->operand_type_end()); - funcWorklist.push_back( - {callee, std::move(mangledName), std::move(funcArgs)}); + funcWorklist.push_back({callee, std::move(mangledName), + llvm::to_vector<4>(op->getOperandTypes())}); return mlir::success(); } // Found a specialized callee! Let's turn this into a normal call -- 2.7.4