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
This commit is contained in:
Alex Zinenko 2019-12-19 11:34:43 -08:00 committed by A. Unique TensorFlower
parent 50f9be6d2d
commit efadb6b838
2 changed files with 12 additions and 10 deletions

View File

@ -87,16 +87,8 @@ protected:
llvm::IRBuilder<> &builder);
static std::unique_ptr<llvm::Module> prepareLLVMModule(Operation *m);
// A helper to look up remapped operands in the value remapping table.
template <typename Range>
SmallVector<llvm::Value *, 8> lookupValues(Range &&values) {
SmallVector<llvm::Value *, 8> 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<llvm::Value *, 8> lookupValues(ValueRange values);
private:
/// Check whether the module contains only supported ops directly in its body.

View File

@ -492,6 +492,16 @@ LogicalResult ModuleTranslation::convertFunctions() {
return success();
}
/// A helper to look up remapped operands in the value remapping table.`
SmallVector<llvm::Value *, 8>
ModuleTranslation::lookupValues(ValueRange values) {
SmallVector<llvm::Value *, 8> remapped;
remapped.reserve(values.size());
for (Value *v : values)
remapped.push_back(valueMapping.lookup(v));
return remapped;
}
std::unique_ptr<llvm::Module>
ModuleTranslation::prepareLLVMModule(Operation *m) {
auto *dialect = m->getContext()->getRegisteredDialect<LLVM::LLVMDialect>();