From: River Riddle Date: Thu, 30 May 2019 21:58:28 +0000 (-0700) Subject: Replace a usage of std::vector with SmallVector to allow constructing with non... X-Git-Tag: llvmorg-11-init~1466^2~1546 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fd012cda215805a1fe34449fb7b28f6644842ba;p=platform%2Fupstream%2Fllvm.git Replace a usage of std::vector with SmallVector to allow constructing with non-constant iterators on MSVC. -- PiperOrigin-RevId: 250769027 --- 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