From: Alex Zinenko Date: Thu, 19 Dec 2019 19:34:43 +0000 (-0800) Subject: Detemplatize ModuleTranslation::lookupValues X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efadb6b8388344bcf13b739fdc22dd8812df5b3b;p=platform%2Fupstream%2Fllvm.git Detemplatize ModuleTranslation::lookupValues This function template has been introduced in the early days of MLIR to work around the absence of common type for ranges of values (operands, block argumeents, vectors, etc). Core IR now provides ValueRange for exactly this purpose. Use it instead of the template parameter. PiperOrigin-RevId: 286431338 --- diff --git a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h index da2670a..7adb4aa 100644 --- a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h +++ b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h @@ -87,16 +87,8 @@ protected: llvm::IRBuilder<> &builder); static std::unique_ptr prepareLLVMModule(Operation *m); - // A helper to look up remapped operands in the value remapping table. - template - SmallVector lookupValues(Range &&values) { - SmallVector remapped; - remapped.reserve(llvm::size(values)); - for (Value *v : values) { - remapped.push_back(valueMapping.lookup(v)); - } - return remapped; - } + /// A helper to look up remapped operands in the value remapping table. + SmallVector lookupValues(ValueRange values); private: /// Check whether the module contains only supported ops directly in its body. diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index 6206a88..e59c69a 100644 --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -492,6 +492,16 @@ LogicalResult ModuleTranslation::convertFunctions() { return success(); } +/// A helper to look up remapped operands in the value remapping table.` +SmallVector +ModuleTranslation::lookupValues(ValueRange values) { + SmallVector remapped; + remapped.reserve(values.size()); + for (Value *v : values) + remapped.push_back(valueMapping.lookup(v)); + return remapped; +} + std::unique_ptr ModuleTranslation::prepareLLVMModule(Operation *m) { auto *dialect = m->getContext()->getRegisteredDialect();