[mlir][NFC] Replace mlir/Support/Functional.h with llvm equivalents.

Summary: Functional.h contains many different methods that have a direct, and more efficient, equivalent in LLVM. This revision replaces all usages with the LLVM equivalent, and removes the header. This is part of larger cleanup, pr45513, merging MLIR support facilities into LLVM.

Differential Revision: https://reviews.llvm.org/D78053
This commit is contained in:
River Riddle 2020-04-13 14:07:38 -07:00
parent 9d8c22587b
commit d3588d0814
22 changed files with 69 additions and 217 deletions

View File

@ -2064,9 +2064,10 @@ class TCOpIsBroadcastableToRes<int opId, int resId> : And<[
// 1) all operands involved are of shaped type and
// 2) the indices are not out of range.
class TCopVTEtAreSameAt<list<int> indices> : CPred<
"llvm::is_splat(mlir::functional::map("
"[this](unsigned i) { return getElementTypeOrSelf(this->getOperand(i)); }, "
"llvm::ArrayRef<unsigned>({" # StrJoinInt<indices>.result # "})))">;
"llvm::is_splat(llvm::map_range("
"llvm::ArrayRef<unsigned>({" # StrJoinInt<indices>.result # "}), "
"[this](unsigned i) { return getElementTypeOrSelf(this->getOperand(i)); "
"}))">;
//===----------------------------------------------------------------------===//
// Pattern definitions

View File

@ -1,113 +0,0 @@
//===- Functional.h - Helpers for functional-style Combinators --*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_SUPPORT_FUNCTIONAL_H_
#define MLIR_SUPPORT_FUNCTIONAL_H_
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
/// This file provides some simple template functional-style sugar to operate
/// on **value** types. Make sure when using that the stored type is cheap to
/// copy!
///
/// TODO(ntv): add some static_assert but we need proper traits for this.
namespace mlir {
namespace functional {
/// Map with iterators.
template <typename Fn, typename IterType>
auto map(Fn fun, IterType begin, IterType end)
-> SmallVector<typename std::result_of<Fn(decltype(*begin))>::type, 8> {
using R = typename std::result_of<Fn(decltype(*begin))>::type;
SmallVector<R, 8> res;
// auto i works with both pointer types and value types with an operator*.
// auto *i only works for pointer types.
for (auto i = begin; i != end; ++i) {
res.push_back(fun(*i));
}
return res;
}
/// Map with templated container.
template <typename Fn, typename ContainerType>
auto map(Fn fun, ContainerType input)
-> decltype(map(fun, std::begin(input), std::end(input))) {
return map(fun, std::begin(input), std::end(input));
}
/// Zip map with 2 templated container, iterates to the min of the sizes of
/// the 2 containers.
/// TODO(ntv): make variadic when needed.
template <typename Fn, typename ContainerType1, typename ContainerType2>
auto zipMap(Fn fun, ContainerType1 input1, ContainerType2 input2)
-> SmallVector<typename std::result_of<Fn(decltype(*input1.begin()),
decltype(*input2.begin()))>::type,
8> {
using R = typename std::result_of<Fn(decltype(*input1.begin()),
decltype(*input2.begin()))>::type;
SmallVector<R, 8> res;
auto zipIter = llvm::zip(input1, input2);
for (auto it : zipIter) {
res.push_back(fun(std::get<0>(it), std::get<1>(it)));
}
return res;
}
/// Apply with iterators.
template <typename Fn, typename IterType>
void apply(Fn fun, IterType begin, IterType end) {
// auto i works with both pointer types and value types with an operator*.
// auto *i only works for pointer types.
for (auto i = begin; i != end; ++i) {
fun(*i);
}
}
/// Apply with templated container.
template <typename Fn, typename ContainerType>
void apply(Fn fun, ContainerType input) {
return apply(fun, std::begin(input), std::end(input));
}
/// Zip apply with 2 templated container, iterates to the min of the sizes of
/// the 2 containers.
/// TODO(ntv): make variadic when needed.
template <typename Fn, typename ContainerType1, typename ContainerType2>
void zipApply(Fn fun, ContainerType1 input1, ContainerType2 input2) {
auto zipIter = llvm::zip(input1, input2);
for (auto it : zipIter) {
fun(std::get<0>(it), std::get<1>(it));
}
}
/// Unwraps a pointer type to another type (possibly the same).
/// Used in particular to allow easier compositions of
/// Operation::operand_range types.
template <typename T, typename ToType = T>
inline std::function<ToType *(T *)> makePtrDynCaster() {
return [](T *val) { return dyn_cast<ToType>(val); };
}
/// Simple ScopeGuard.
struct ScopeGuard {
explicit ScopeGuard(std::function<void(void)> destruct)
: destruct(destruct) {}
~ScopeGuard() { destruct(); }
private:
std::function<void(void)> destruct;
};
} // namespace functional
} // namespace mlir
#endif // MLIR_SUPPORT_FUNCTIONAL_H_

View File

@ -15,7 +15,6 @@
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
#include "llvm/ADT/SetVector.h"

View File

@ -23,7 +23,6 @@
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
@ -222,13 +221,13 @@ Optional<SmallVector<Value, 8>> mlir::expandAffineMap(OpBuilder &builder,
AffineMap affineMap,
ValueRange operands) {
auto numDims = affineMap.getNumDims();
auto expanded = functional::map(
[numDims, &builder, loc, operands](AffineExpr expr) {
return expandAffineExpr(builder, loc, expr,
operands.take_front(numDims),
operands.drop_front(numDims));
},
affineMap.getResults());
auto expanded = llvm::to_vector<8>(
llvm::map_range(affineMap.getResults(),
[numDims, &builder, loc, operands](AffineExpr expr) {
return expandAffineExpr(builder, loc, expr,
operands.take_front(numDims),
operands.drop_front(numDims));
}));
if (llvm::all_of(expanded, [](Value v) { return v; }))
return expanded;
return None;

View File

@ -20,7 +20,6 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/Functional.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/Utils.h"

View File

@ -23,7 +23,6 @@
#include "mlir/IR/Module.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"

View File

@ -25,7 +25,6 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Types.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/FoldUtils.h"
@ -525,8 +524,6 @@ using namespace mlir;
#define DEBUG_TYPE "early-vect"
using functional::makePtrDynCaster;
using functional::map;
using llvm::dbgs;
using llvm::SetVector;
@ -812,7 +809,6 @@ static LogicalResult vectorizeRootOrTerminal(Value iv,
/// operations into the appropriate vector.transfer.
static LogicalResult vectorizeAffineForOp(AffineForOp loop, int64_t step,
VectorizationState *state) {
using namespace functional;
loop.setStep(step);
FilterFunctionType notVectorizedThisPattern = [state](Operation &op) {

View File

@ -16,7 +16,6 @@
#include "mlir/Dialect/LoopOps/EDSC/Builders.h"
#include "mlir/Dialect/StandardOps/EDSC/Intrinsics.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Transforms/LoopUtils.h"
using namespace mlir;

View File

@ -13,7 +13,6 @@
#include "mlir/Dialect/StandardOps/EDSC/Intrinsics.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/Support/Functional.h"
using namespace mlir;
using namespace mlir::edsc;
@ -164,7 +163,8 @@ Operation *mlir::edsc::makeGenericLinalgOp(
std::copy_if(outputs.begin(), outputs.end(), std::back_inserter(types),
[](StructuredIndexed s) { return !s.hasValue(); });
auto iteratorStrTypes = functional::map(toString, iteratorTypes);
auto iteratorStrTypes =
llvm::to_vector<8>(llvm::map_range(iteratorTypes, toString));
// clang-format off
auto *op =
edsc::ScopedContext::getBuilder()

View File

@ -21,7 +21,6 @@
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
@ -500,8 +499,8 @@ computeReshapeCollapsedType(MemRefType type,
/// TODO(rridle,ntv) this should be evolved into a generic
/// `getRangeOfType<AffineMap>(ArrayAttr attrs)` that does not copy.
static SmallVector<AffineMap, 4> getAffineMaps(ArrayAttr attrs) {
return functional::map(
[](Attribute a) { return a.cast<AffineMapAttr>().getValue(); }, attrs);
return llvm::to_vector<8>(llvm::map_range(
attrs, [](Attribute a) { return a.cast<AffineMapAttr>().getValue(); }));
}
template <typename AffineExprTy>

View File

@ -19,7 +19,6 @@
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
#include "mlir/Transforms/DialectConversion.h"
@ -113,8 +112,8 @@ getInputAndOutputIndices(ArrayRef<Value> allIvs, SingleInputPoolingOp op) {
auto &b = ScopedContext::getBuilder();
auto loc = ScopedContext::getLocation();
auto mapsRange = op.indexing_maps().template getAsRange<AffineMapAttr>();
auto maps =
functional::map([](AffineMapAttr a) { return a.getValue(); }, mapsRange);
auto maps = llvm::to_vector<8>(
llvm::map_range(mapsRange, [](AffineMapAttr a) { return a.getValue(); }));
SmallVector<ValueHandle, 8> iIdx(
makeCanonicalAffineApplies(b, loc, maps[0], allIvs));
SmallVector<ValueHandle, 8> oIdx(
@ -273,8 +272,8 @@ public:
auto b = ScopedContext::getBuilder();
auto loc = ScopedContext::getLocation();
auto mapsRange = convOp.indexing_maps().getAsRange<AffineMapAttr>();
auto maps = functional::map([](AffineMapAttr a) { return a.getValue(); },
mapsRange);
auto maps = llvm::to_vector<8>(llvm::map_range(
mapsRange, [](AffineMapAttr a) { return a.getValue(); }));
SmallVector<ValueHandle, 8> fIdx(
makeCanonicalAffineApplies(b, loc, maps[0], allIvs));
SmallVector<ValueHandle, 8> imIdx(
@ -650,8 +649,8 @@ LinalgOpToLoopsImpl<LoopTy, ConcreteOpTy>::doit(Operation *op,
auto nLoops = nPar + nRed + nWin;
auto mapsRange =
linalgOp.indexing_maps().template getAsRange<AffineMapAttr>();
auto maps =
functional::map([](AffineMapAttr a) { return a.getValue(); }, mapsRange);
auto maps = llvm::to_vector<8>(
llvm::map_range(mapsRange, [](AffineMapAttr a) { return a.getValue(); }));
AffineMap invertedMap = inversePermutation(concatAffineMaps(maps));
if (invertedMap.isEmpty()) {
LinalgScopedEmitter<IndexedValueTy, ConcreteOpTy>::emitScalarImplementation(

View File

@ -21,7 +21,6 @@
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
#include "mlir/Transforms/FoldUtils.h"
@ -359,8 +358,8 @@ Optional<TiledLinalgOp> static tileLinalgOpImpl(OpBuilder &b, LinalgOp op,
// The flattened loopToOperandRangesMaps is expected to be an invertible
// permutation map (asserted in the inverse calculation).
auto mapsRange = op.indexing_maps().getAsRange<AffineMapAttr>();
auto maps =
functional::map([](AffineMapAttr a) { return a.getValue(); }, mapsRange);
auto maps = llvm::to_vector<8>(
llvm::map_range(mapsRange, [](AffineMapAttr a) { return a.getValue(); }));
auto viewSizesToLoopsMap = inversePermutation(concatAffineMaps(maps));
assert(viewSizesToLoopsMap && "expected invertible map");

View File

@ -17,7 +17,6 @@
#include "mlir/Dialect/SPIRV/SPIRVTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/Functional.h"
using namespace mlir;
@ -131,11 +130,10 @@ void spirv::BitcastOp::getCanonicalizationPatterns(
OpFoldResult spirv::CompositeExtractOp::fold(ArrayRef<Attribute> operands) {
assert(operands.size() == 1 && "spv.CompositeExtract expects one operand");
auto indexVector = functional::map(
[](Attribute attr) {
auto indexVector =
llvm::to_vector<8>(llvm::map_range(indices(), [](Attribute attr) {
return static_cast<unsigned>(attr.cast<IntegerAttr>().getInt());
},
indices());
}));
return extractCompositeElement(operands[0], indexVector);
}

View File

@ -13,7 +13,6 @@
#include "mlir/EDSC/Intrinsics.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/Builders.h"
#include "mlir/Support/Functional.h"
using namespace mlir;
using namespace mlir::edsc;
@ -27,7 +26,8 @@ Value mlir::edsc::ops::vector_contraction(
return vector_contract(
A.getValue(), B.getValue(), C.getValue(),
IndexingExprs{A.getExprs(), B.getExprs(), C.getExprs()},
ArrayRef<StringRef>{functional::map(toString, iteratorTypes)});
ArrayRef<StringRef>{
llvm::to_vector<8>(llvm::map_range(iteratorTypes, toString))});
}
Value mlir::edsc::ops::vector_contraction_matmul(Value A, Value B, Value C) {

View File

@ -21,7 +21,6 @@
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/MathExtras.h"
#include "mlir/Support/STLExtras.h"
@ -893,12 +892,10 @@ static LogicalResult isSumOfIntegerArrayAttrConfinedToShape(
static ArrayAttr makeI64ArrayAttr(ArrayRef<int64_t> values,
MLIRContext *context) {
auto attrs = functional::map(
[context](int64_t v) -> Attribute {
return IntegerAttr::get(IntegerType::get(64, context), APInt(64, v));
},
values);
return ArrayAttr::get(attrs, context);
auto attrs = llvm::map_range(values, [context](int64_t v) -> Attribute {
return IntegerAttr::get(IntegerType::get(64, context), APInt(64, v));
});
return ArrayAttr::get(llvm::to_vector<8>(attrs), context);
}
static LogicalResult verify(InsertStridedSliceOp op) {

View File

@ -29,7 +29,6 @@
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Types.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/STLExtras.h"
#include "llvm/Support/CommandLine.h"
@ -40,7 +39,6 @@
using namespace mlir;
using llvm::dbgs;
using mlir::functional::zipMap;
/// Given a shape with sizes greater than 0 along all dimensions,
/// returns the distance, in number of elements, between a slice in a dimension
@ -774,19 +772,15 @@ static Value getProducerValue(Value consumerValue) {
int i = sourceVectorRank - 1;
int j = resultVectorRank - 1;
// Check that source/result vector shape prefixes match while
// updating 'newOffsets'.
bool canShapeCastFold = true;
// Check that source/result vector shape prefixes match while updating
// 'newOffsets'.
SmallVector<int64_t, 4> newOffsets(sourceVectorRank, 0);
auto apply = [&](int64_t sourceSize, int64_t resultSize) {
canShapeCastFold = sourceSize == resultSize;
for (auto it : llvm::zip(llvm::reverse(sourceVectorShape),
llvm::reverse(resultVectorShape))) {
if (std::get<0>(it) != std::get<1>(it))
return nullptr;
newOffsets[i--] = offsets[j--];
};
functional::zipApply(apply, llvm::reverse(sourceVectorShape),
llvm::reverse(resultVectorShape));
if (!canShapeCastFold)
return nullptr;
}
// Check that remaining prefix of source/result vector shapes are all 1s.
// Currently we only support producer/consumer tracking through trivial

View File

@ -18,7 +18,6 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/MathExtras.h"
#include "mlir/Support/STLExtras.h"
@ -67,8 +66,10 @@ SmallVector<int64_t, 4> mlir::delinearize(ArrayRef<int64_t> sliceStrides,
SmallVector<int64_t, 4> mlir::computeElementOffsetsFromVectorSliceOffsets(
ArrayRef<int64_t> sizes, ArrayRef<int64_t> vectorOffsets) {
return functional::zipMap([](int64_t v1, int64_t v2) { return v1 * v2; },
vectorOffsets, sizes);
SmallVector<int64_t, 4> result;
for (auto it : llvm::zip(vectorOffsets, sizes))
result.push_back(std::get<0>(it) * std::get<1>(it));
return result;
}
SmallVector<int64_t, 4>
@ -88,23 +89,19 @@ Optional<SmallVector<int64_t, 4>> mlir::shapeRatio(ArrayRef<int64_t> superShape,
}
// Starting from the end, compute the integer divisors.
// Set the boolean `divides` if integral division is not possible.
std::vector<int64_t> result;
result.reserve(superShape.size());
bool divides = true;
auto divide = [&divides, &result](int superSize, int subSize) {
int64_t superSize = 0, subSize = 0;
for (auto it :
llvm::zip(llvm::reverse(superShape), llvm::reverse(subShape))) {
std::tie(superSize, subSize) = it;
assert(superSize > 0 && "superSize must be > 0");
assert(subSize > 0 && "subSize must be > 0");
divides &= (superSize % subSize == 0);
result.push_back(superSize / subSize);
};
functional::zipApply(
divide, SmallVector<int64_t, 8>{superShape.rbegin(), superShape.rend()},
SmallVector<int64_t, 8>{subShape.rbegin(), subShape.rend()});
// If integral division does not occur, return and let the caller decide.
if (!divides) {
return None;
// If integral division does not occur, return and let the caller decide.
if (superSize % subSize != 0)
return None;
result.push_back(superSize / subSize);
}
// At this point we computed the ratio (in reverse) for the common
@ -157,8 +154,6 @@ static AffineMap makePermutationMap(
return AffineMap();
MLIRContext *context =
enclosingLoopToVectorDim.begin()->getFirst()->getContext();
using functional::makePtrDynCaster;
using functional::map;
SmallVector<AffineExpr, 4> perm(enclosingLoopToVectorDim.size(),
getAffineConstantExpr(0, context));

View File

@ -10,7 +10,6 @@
#include "AffineMapDetail.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/MathExtras.h"
#include "llvm/ADT/StringRef.h"

View File

@ -14,7 +14,6 @@
#include "mlir/IR/Matchers.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/Support/Functional.h"
#include "llvm/Support/raw_ostream.h"
using namespace mlir;
@ -204,47 +203,46 @@ Builder::getSymbolRefAttr(StringRef value,
}
ArrayAttr Builder::getI32ArrayAttr(ArrayRef<int32_t> values) {
auto attrs = functional::map(
[this](int32_t v) -> Attribute { return getI32IntegerAttr(v); }, values);
auto attrs = llvm::to_vector<8>(llvm::map_range(
values, [this](int32_t v) -> Attribute { return getI32IntegerAttr(v); }));
return getArrayAttr(attrs);
}
ArrayAttr Builder::getI64ArrayAttr(ArrayRef<int64_t> values) {
auto attrs = functional::map(
[this](int64_t v) -> Attribute { return getI64IntegerAttr(v); }, values);
auto attrs = llvm::to_vector<8>(llvm::map_range(
values, [this](int64_t v) -> Attribute { return getI64IntegerAttr(v); }));
return getArrayAttr(attrs);
}
ArrayAttr Builder::getIndexArrayAttr(ArrayRef<int64_t> values) {
auto attrs = functional::map(
[this](int64_t v) -> Attribute {
auto attrs = llvm::to_vector<8>(
llvm::map_range(values, [this](int64_t v) -> Attribute {
return getIntegerAttr(IndexType::get(getContext()), v);
},
values);
}));
return getArrayAttr(attrs);
}
ArrayAttr Builder::getF32ArrayAttr(ArrayRef<float> values) {
auto attrs = functional::map(
[this](float v) -> Attribute { return getF32FloatAttr(v); }, values);
auto attrs = llvm::to_vector<8>(llvm::map_range(
values, [this](float v) -> Attribute { return getF32FloatAttr(v); }));
return getArrayAttr(attrs);
}
ArrayAttr Builder::getF64ArrayAttr(ArrayRef<double> values) {
auto attrs = functional::map(
[this](double v) -> Attribute { return getF64FloatAttr(v); }, values);
auto attrs = llvm::to_vector<8>(llvm::map_range(
values, [this](double v) -> Attribute { return getF64FloatAttr(v); }));
return getArrayAttr(attrs);
}
ArrayAttr Builder::getStrArrayAttr(ArrayRef<StringRef> values) {
auto attrs = functional::map(
[this](StringRef v) -> Attribute { return getStringAttr(v); }, values);
auto attrs = llvm::to_vector<8>(llvm::map_range(
values, [this](StringRef v) -> Attribute { return getStringAttr(v); }));
return getArrayAttr(attrs);
}
ArrayAttr Builder::getAffineMapArrayAttr(ArrayRef<AffineMap> values) {
auto attrs = functional::map(
[](AffineMap v) -> Attribute { return AffineMapAttr::get(v); }, values);
auto attrs = llvm::to_vector<8>(llvm::map_range(
values, [](AffineMap v) -> Attribute { return AffineMapAttr::get(v); }));
return getArrayAttr(attrs);
}

View File

@ -24,7 +24,6 @@
#include "mlir/IR/Types.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/Functional.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Passes.h"

View File

@ -19,7 +19,6 @@
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/STLExtras.h"
#include "mlir/Transforms/Passes.h"
@ -33,8 +32,6 @@ using namespace mlir;
using llvm::SetVector;
using functional::map;
static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options");
static llvm::cl::list<int> clTestVectorShapeRatio(
@ -129,7 +126,6 @@ void VectorizerTestPass::testVectorShapeRatio(llvm::raw_ostream &outs) {
}
static NestedPattern patternTestSlicingOps() {
using functional::map;
using matcher::Op;
// Match all operations with the kTestSlicingOpName name.
auto filter = [](Operation &op) {

View File

@ -81,9 +81,9 @@ def OpJ: NS_Op<"op_for_TCopVTEtAreSameAt", [
}
// CHECK-LABEL: OpJ::verify()
// CHECK: llvm::is_splat(mlir::functional::map(
// CHECK-SAME: [this](unsigned i) { return getElementTypeOrSelf(this->getOperand(i)); },
// CHECK-SAME: llvm::ArrayRef<unsigned>({0, 2, 3})))
// CHECK: llvm::is_splat(llvm::map_range(
// CHECK-SAME: llvm::ArrayRef<unsigned>({0, 2, 3}),
// CHECK-SAME: [this](unsigned i) { return getElementTypeOrSelf(this->getOperand(i)); }))
// CHECK: return emitOpError("failed to verify that operands indexed at 0, 2, 3 should all have the same type");
def OpK : NS_Op<"op_for_AnyTensorOf", []> {