diff --git a/mlir/include/mlir/IR/BlockAndValueMapping.h b/mlir/include/mlir/IR/BlockAndValueMapping.h --- a/mlir/include/mlir/IR/BlockAndValueMapping.h +++ b/mlir/include/mlir/IR/BlockAndValueMapping.h @@ -15,6 +15,7 @@ #define MLIR_IR_BLOCKANDVALUEMAPPING_H #include "mlir/IR/Block.h" +#include "mlir/IR/OperationSupport.h" namespace mlir { // This is a utility class for mapping one set of values to another. New @@ -31,6 +32,10 @@ void map(Value from, Value to) { valueMap[from.getAsOpaquePointer()] = to.getAsOpaquePointer(); } + void map(ValueRange from, ValueRange to) { + for (auto pair : llvm::zip(from, to)) + map(std::get<0>(pair), std::get<1>(pair)); + } /// Erases a mapping for 'from'. void erase(Block *from) { valueMap.erase(from); }