12 changes: 6 additions & 6 deletions mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void mlir::linalg::hoistRedundantVectorTransfers(FuncOp func) {
LLVM_DEBUG(DBGS() << "Candidate read: " << *transferRead.getOperation()
<< "\n");

llvm::SetVector<Operation *> forwardSlice;
SetVector<Operation *> forwardSlice;
getForwardSlice(transferRead.getOperation(), &forwardSlice);

// Look for the last TransferWriteOp in the forwardSlice of
Expand Down Expand Up @@ -510,7 +510,7 @@ void mlir::linalg::hoistRedundantVectorTransfers(FuncOp func) {
template <typename... OpTypeList>
static bool backwardsSliceOnlyHasOpsOfType(scf::ForOp outerLimit, Value v) {
// Compute a backward slice up to, but not including, `outerLimit`.
llvm::SetVector<Operation *> backwardSlice;
SetVector<Operation *> backwardSlice;
getBackwardSlice(v, &backwardSlice, [&](Operation *op) {
return outerLimit->isProperAncestor(op);
});
Expand Down Expand Up @@ -557,7 +557,7 @@ static Value computeLoopIndependentUpperBound(OpBuilder &b, scf::ForOp outer,
(void)ok;

// Compute a backward slice up to, but not including, `outer`.
llvm::SetVector<Operation *> backwardSlice;
SetVector<Operation *> backwardSlice;
getBackwardSlice(v, &backwardSlice,
[&](Operation *op) { return outer->isProperAncestor(op); });
backwardSlice.insert(v.getDefiningOp());
Expand Down Expand Up @@ -655,8 +655,8 @@ static Value buildLoopIterationCount(OpBuilder &b, scf::ForOp outer,
/// dimensions of reuse.
static LogicalResult
hoistPaddingOnTensorsPrerequisites(linalg::PadTensorOp padTensorOp, int nLevels,
llvm::SetVector<Operation *> &backwardSlice,
llvm::SetVector<Operation *> &packingLoops,
SetVector<Operation *> &backwardSlice,
SetVector<Operation *> &packingLoops,
SmallVector<Value> &dynamicTensorSizes) {
// Bail on any use that isn't an input of a Linalg op.
// Hoisting of inplace updates happens after vectorization.
Expand Down Expand Up @@ -746,7 +746,7 @@ hoistPaddingOnTensorsPrerequisites(linalg::PadTensorOp padTensorOp, int nLevels,
LogicalResult mlir::linalg::hoistPaddingOnTensors(PadTensorOp &padTensorOp,
unsigned nLoops) {
SmallVector<Value> dynamicTensorSizes;
llvm::SetVector<Operation *> backwardSlice, packingLoops;
SetVector<Operation *> backwardSlice, packingLoops;
if (failed(hoistPaddingOnTensorsPrerequisites(padTensorOp, nLoops,
backwardSlice, packingLoops,
dynamicTensorSizes)))
Expand Down
20 changes: 7 additions & 13 deletions mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,12 @@ namespace {
/// The padding value for a given Op depends on the semantics of the Op.
/// The identity value for ConvOp and PoolingSumOp is 0, for PoolingMaxOp is
/// -inf or minInt and for PoolingMinOp is inf or maxInt.
template <typename OpType>
Attribute getPadValueAttr(Type type) {
template <typename OpType> Attribute getPadValueAttr(Type type) {
llvm_unreachable("Unexpected op type for getPadValueAttr");
return {};
}

template <>
Attribute getPadValueAttr<PoolingMaxOp>(Type type) {
template <> Attribute getPadValueAttr<PoolingMaxOp>(Type type) {
auto &b = ScopedContext::getBuilderRef();
if (auto floatType = type.dyn_cast<FloatType>()) {
return b.getFloatAttr(
Expand All @@ -248,8 +246,7 @@ Attribute getPadValueAttr<PoolingMaxOp>(Type type) {
return {};
}

template <>
Attribute getPadValueAttr<PoolingMinOp>(Type type) {
template <> Attribute getPadValueAttr<PoolingMinOp>(Type type) {
auto &b = ScopedContext::getBuilderRef();
if (auto floatType = type.dyn_cast<FloatType>()) {
return b.getFloatAttr(floatType,
Expand All @@ -266,14 +263,12 @@ Attribute getPadValueAttr<PoolingMinOp>(Type type) {
return {};
}

template <>
Attribute getPadValueAttr<PoolingSumOp>(Type type) {
template <> Attribute getPadValueAttr<PoolingSumOp>(Type type) {
auto &b = ScopedContext::getBuilderRef();
return b.getZeroAttr(type);
}

template <>
Attribute getPadValueAttr<ConvOp>(Type type) {
template <> Attribute getPadValueAttr<ConvOp>(Type type) {
auto &b = ScopedContext::getBuilderRef();
return b.getZeroAttr(type);
}
Expand Down Expand Up @@ -324,8 +319,7 @@ static void emitScalarImplementation(ArrayRef<Value> allIvs, ConvOp convOp) {
}
}

template <typename PoolingOp>
static bool hasPadding(PoolingOp poolingOp) {
template <typename PoolingOp> static bool hasPadding(PoolingOp poolingOp) {
for (unsigned i = 0, e = poolingOp.getNumWindowLoops(); i < e; ++i) {
if (poolingOp.getLowPad(i) > 0 || poolingOp.getHighPad(i) > 0)
return true;
Expand Down Expand Up @@ -501,7 +495,7 @@ linalgOpToLoopsImpl(Operation *op, OpBuilder &builder,
});
// Number of loop ops might be different from the number of ivs since some
// loops like affine.parallel and scf.parallel have multiple ivs.
llvm::SetVector<Operation *> loopSet;
SetVector<Operation *> loopSet;
for (Value iv : allIvs) {
if (!iv)
return {};
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static LogicalResult rewriteAsPaddedOp(PatternRewriter &rewriter,
// This later folds away.
SmallVector<Value> paddedSubviewResults;
paddedSubviewResults.reserve(opToPad->getNumResults());
llvm::SetVector<Operation *> newUsersOfOpToPad;
SetVector<Operation *> newUsersOfOpToPad;
for (auto it : llvm::zip(opToPad->getResults(), paddedOp->getResults())) {
auto rank = std::get<0>(it).getType().cast<RankedTensorType>().getRank();
SmallVector<OpFoldResult> offsets(rank, rewriter.getIndexAttr(0));
Expand Down
5 changes: 2 additions & 3 deletions mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ using llvm::dbgs;

/// Return the unique instance of OpType in `block` if it is indeed unique.
/// Return null if none or more than 1 instances exist.
template <typename OpType>
static OpType getSingleOpOfType(Block &block) {
template <typename OpType> static OpType getSingleOpOfType(Block &block) {
OpType res;
block.walk([&](OpType op) {
if (res) {
Expand Down Expand Up @@ -307,7 +306,7 @@ LogicalResult vectorizeAsLinalgGeneric(
BlockAndValueMapping bvm;
// 2. Values defined above the region can only be broadcast for now. Make them
// map to themselves.
llvm::SetVector<Value> valuesSet;
SetVector<Value> valuesSet;
mlir::getUsedValuesDefinedAbove(linalgOp->getRegion(0), valuesSet);
bvm.map(valuesSet.getArrayRef(), valuesSet.getArrayRef());

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/SCF/Transforms/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void mlir::outlineIfOp(OpBuilder &b, scf::IfOp ifOp, FuncOp *thenFn,
OpBuilder::InsertionGuard g(b);
b.setInsertionPoint(ifOp->getParentOfType<FuncOp>());

llvm::SetVector<Value> captures;
SetVector<Value> captures;
getUsedValuesDefinedAbove(ifOrElseRegion, captures);

ValueRange values(captures.getArrayRef());
Expand Down
22 changes: 10 additions & 12 deletions mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,7 @@ namespace {
// parseAndVerify does the actual parsing and verification of individual
// elements. This is a functor since parsing the last element of the list
// (termination condition) needs partial specialization.
template <typename ParseType, typename... Args>
struct ParseCommaSeparatedList {
template <typename ParseType, typename... Args> struct ParseCommaSeparatedList {
Optional<std::tuple<ParseType, Args...>>
operator()(SPIRVDialect const &dialect, DialectAsmParser &parser) const {
auto parseVal = parseAndVerify<ParseType>(dialect, parser);
Expand All @@ -502,8 +501,7 @@ struct ParseCommaSeparatedList {

// Partial specialization of the function to parse a comma separated list of
// specs to parse the last element of the list.
template <typename ParseType>
struct ParseCommaSeparatedList<ParseType> {
template <typename ParseType> struct ParseCommaSeparatedList<ParseType> {
Optional<std::tuple<ParseType>> operator()(SPIRVDialect const &dialect,
DialectAsmParser &parser) const {
if (auto value = parseAndVerify<ParseType>(dialect, parser))
Expand Down Expand Up @@ -636,15 +634,15 @@ static Type parseStructType(SPIRVDialect const &dialect,
//
// Note: This has to be thread_local to enable multiple threads to safely
// parse concurrently.
thread_local llvm::SetVector<StringRef> structContext;
thread_local SetVector<StringRef> structContext;

static auto removeIdentifierAndFail =
[](llvm::SetVector<StringRef> &structContext, StringRef identifier) {
if (!identifier.empty())
structContext.remove(identifier);
static auto removeIdentifierAndFail = [](SetVector<StringRef> &structContext,
StringRef identifier) {
if (!identifier.empty())
structContext.remove(identifier);

return Type();
};
return Type();
};

if (parser.parseLess())
return Type();
Expand Down Expand Up @@ -801,7 +799,7 @@ static void print(SampledImageType type, DialectAsmPrinter &os) {
}

static void print(StructType type, DialectAsmPrinter &os) {
thread_local llvm::SetVector<StringRef> structContext;
thread_local SetVector<StringRef> structContext;

os << "struct<";

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ArrayRef<spirv::Extension> spirv::getImpliedExtensions(spirv::Version version) {
SmallVector<spirv::Capability, 0>
spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) {
ArrayRef<spirv::Capability> directCaps = getDirectImpliedCapabilities(cap);
llvm::SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
directCaps.begin(), directCaps.end());

// TODO: This is insufficient; find a better way to handle this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ getInterfaceVariables(spirv::FuncOp funcOp,
if (!module) {
return failure();
}
llvm::SetVector<Operation *> interfaceVarSet;
SetVector<Operation *> interfaceVarSet;

// TODO: This should in reality traverse the entry function
// call graph and collect all the interfaces. For now, just traverse the
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class UpdateVCEPass final : public SPIRVUpdateVCEBase<UpdateVCEPass> {
static LogicalResult checkAndUpdateExtensionRequirements(
Operation *op, const spirv::TargetEnv &targetEnv,
const spirv::SPIRVType::ExtensionArrayRefVector &candidates,
llvm::SetVector<spirv::Extension> &deducedExtensions) {
SetVector<spirv::Extension> &deducedExtensions) {
for (const auto &ors : candidates) {
if (Optional<spirv::Extension> chosen = targetEnv.allows(ors)) {
deducedExtensions.insert(*chosen);
Expand Down Expand Up @@ -70,7 +70,7 @@ static LogicalResult checkAndUpdateExtensionRequirements(
static LogicalResult checkAndUpdateCapabilityRequirements(
Operation *op, const spirv::TargetEnv &targetEnv,
const spirv::SPIRVType::CapabilityArrayRefVector &candidates,
llvm::SetVector<spirv::Capability> &deducedCapabilities) {
SetVector<spirv::Capability> &deducedCapabilities) {
for (const auto &ors : candidates) {
if (Optional<spirv::Capability> chosen = targetEnv.allows(ors)) {
deducedCapabilities.insert(*chosen);
Expand Down Expand Up @@ -101,8 +101,8 @@ void UpdateVCEPass::runOnOperation() {
spirv::Version allowedVersion = targetAttr.getVersion();

spirv::Version deducedVersion = spirv::Version::V_1_0;
llvm::SetVector<spirv::Extension> deducedExtensions;
llvm::SetVector<spirv::Capability> deducedCapabilities;
SetVector<spirv::Extension> deducedExtensions;
SetVector<spirv::Capability> deducedCapabilities;

// Walk each SPIR-V op to deduce the minimal version/extension/capability
// requirements.
Expand Down
2 changes: 0 additions & 2 deletions mlir/lib/Dialect/Vector/VectorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"

using llvm::SetVector;

using namespace mlir;

/// Return the number of elements of basis, `0` if empty.
Expand Down
22 changes: 8 additions & 14 deletions mlir/lib/IR/Diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,21 +366,15 @@ struct SourceMgrDiagnosticHandlerImpl {

/// Return a processable FileLineColLoc from the given location.
static Optional<FileLineColLoc> getFileLineColLoc(Location loc) {
if (auto nameLoc = loc.dyn_cast<NameLoc>())
return getFileLineColLoc(loc.cast<NameLoc>().getChildLoc());
if (auto fileLoc = loc.dyn_cast<FileLineColLoc>())
return fileLoc;
if (auto callLoc = loc.dyn_cast<CallSiteLoc>())
return getFileLineColLoc(loc.cast<CallSiteLoc>().getCallee());
if (auto fusedLoc = loc.dyn_cast<FusedLoc>()) {
for (auto subLoc : loc.cast<FusedLoc>().getLocations()) {
if (auto callLoc = getFileLineColLoc(subLoc)) {
return callLoc;
}
Optional<FileLineColLoc> firstFileLoc;
loc->walk([&](Location loc) {
if (FileLineColLoc fileLoc = loc.dyn_cast<FileLineColLoc>()) {
firstFileLoc = fileLoc;
return WalkResult::interrupt();
}
return llvm::None;
}
return llvm::None;
return WalkResult::advance();
});
return firstFileLoc;
}

/// Return a processable CallSiteLoc from the given location.
Expand Down
27 changes: 27 additions & 0 deletions mlir/lib/IR/Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include "mlir/IR/Location.h"
#include "mlir/IR/BuiltinDialect.h"
#include "mlir/IR/Identifier.h"
#include "mlir/IR/Visitors.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/TypeSwitch.h"

using namespace mlir;
using namespace mlir::detail;
Expand All @@ -36,6 +38,31 @@ void BuiltinDialect::registerLocationAttributes() {
// LocationAttr
//===----------------------------------------------------------------------===//

WalkResult LocationAttr::walk(function_ref<WalkResult(Location)> walkFn) {
if (walkFn(*this).wasInterrupted())
return WalkResult::interrupt();

return TypeSwitch<LocationAttr, WalkResult>(*this)
.Case([&](CallSiteLoc callLoc) -> WalkResult {
if (callLoc.getCallee()->walk(walkFn).wasInterrupted())
return WalkResult::interrupt();
return callLoc.getCaller()->walk(walkFn);
})
.Case([&](FusedLoc fusedLoc) -> WalkResult {
for (Location subLoc : fusedLoc.getLocations())
if (subLoc->walk(walkFn).wasInterrupted())
return WalkResult::interrupt();
return WalkResult::advance();
})
.Case([&](NameLoc nameLoc) -> WalkResult {
return nameLoc.getChildLoc()->walk(walkFn);
})
.Case([&](OpaqueLoc opaqueLoc) -> WalkResult {
return opaqueLoc.getFallbackLocation()->walk(walkFn);
})
.Default(WalkResult::advance());
}

/// Methods for support type inquiry through isa, cast, and dyn_cast.
bool LocationAttr::classof(Attribute attr) {
return attr.isa<CallSiteLoc, FileLineColLoc, FusedLoc, NameLoc, OpaqueLoc,
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/IR/SymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ static SmallVector<SymbolScope, 2> collectSymbolScopes(Operation *symbol,
assert(!symbol->hasTrait<OpTrait::SymbolTable>() || symbol != limit);

// Compute the ancestors of 'limit'.
llvm::SetVector<Operation *, SmallVector<Operation *, 4>,
SmallPtrSet<Operation *, 4>>
SetVector<Operation *, SmallVector<Operation *, 4>,
SmallPtrSet<Operation *, 4>>
limitAncestors;
Operation *limitAncestor = limit;
do {
Expand Down Expand Up @@ -1043,7 +1043,7 @@ void SymbolUserMap::replaceAllUsesWith(Operation *symbol,
auto it = symbolToUsers.find(symbol);
if (it == symbolToUsers.end())
return;
llvm::SetVector<Operation *> &users = it->second;
SetVector<Operation *> &users = it->second;

// Replace the uses within the users of `symbol`.
for (Operation *user : users)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void convertOmpOpRegions(Region &region, StringRef blockName,

// Convert blocks one by one in topological order to ensure
// defs are converted before uses.
llvm::SetVector<Block *> blocks =
SetVector<Block *> blocks =
LLVM::detail::getTopologicallySortedBlocks(region);
for (Block *bb : blocks) {
llvm::BasicBlock *llvmBB = moduleTranslation.lookupBlock(bb);
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ void mlir::LLVM::detail::connectPHINodes(Region &region,
}

/// Sort function blocks topologically.
llvm::SetVector<Block *>
SetVector<Block *>
mlir::LLVM::detail::getTopologicallySortedBlocks(Region &region) {
// For each block that has not been visited yet (i.e. that has no
// predecessors), add it to the list as well as its successors.
llvm::SetVector<Block *> blocks;
SetVector<Block *> blocks;
for (Block &b : region) {
if (blocks.count(&b) == 0) {
llvm::ReversePostOrderTraversal<Block *> traversal(&b);
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ class ControlFlowStructurizer {
Block *mergeBlock;
Block *continueBlock; // nullptr for spv.mlir.selection

llvm::SetVector<Block *> constructBlocks;
SetVector<Block *> constructBlocks;
};
} // namespace

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Target/SPIRV/Deserialization/Deserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class Deserializer {

/// A list of IDs for all types forward-declared through OpTypeForwardPointer
/// instructions.
llvm::SetVector<uint32_t> typeForwardPointerIDs;
SetVector<uint32_t> typeForwardPointerIDs;

/// A list of all structs which have unresolved member types.
SmallVector<DeferredStructTypeInfo, 0> deferredStructTypesInfos;
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,13 @@ LogicalResult Serializer::processType(Location loc, Type type,
uint32_t &typeID) {
// Maintains a set of names for nested identified struct types. This is used
// to properly serialize recursive references.
llvm::SetVector<StringRef> serializationCtx;
SetVector<StringRef> serializationCtx;
return processTypeImpl(loc, type, typeID, serializationCtx);
}

LogicalResult
Serializer::processTypeImpl(Location loc, Type type, uint32_t &typeID,
llvm::SetVector<StringRef> &serializationCtx) {
SetVector<StringRef> &serializationCtx) {
typeID = getTypeID(type);
if (typeID) {
return success();
Expand Down Expand Up @@ -380,7 +380,7 @@ Serializer::processTypeImpl(Location loc, Type type, uint32_t &typeID,
LogicalResult Serializer::prepareBasicType(
Location loc, Type type, uint32_t resultID, spirv::Opcode &typeEnum,
SmallVectorImpl<uint32_t> &operands, bool &deferSerialization,
llvm::SetVector<StringRef> &serializationCtx) {
SetVector<StringRef> &serializationCtx) {
deferSerialization = false;

if (isVoidType(type)) {
Expand Down
7 changes: 3 additions & 4 deletions mlir/lib/Target/SPIRV/Serialization/Serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ class Serializer {
/// serialized type will be returned as `typeID`.
LogicalResult processType(Location loc, Type type, uint32_t &typeID);
LogicalResult processTypeImpl(Location loc, Type type, uint32_t &typeID,
llvm::SetVector<StringRef> &serializationCtx);
SetVector<StringRef> &serializationCtx);

/// Method for preparing basic SPIR-V type serialization. Returns the type's
/// opcode and operands for the instruction via `typeEnum` and `operands`.
LogicalResult prepareBasicType(Location loc, Type type, uint32_t resultID,
spirv::Opcode &typeEnum,
SmallVectorImpl<uint32_t> &operands,
bool &deferSerialization,
llvm::SetVector<StringRef> &serializationCtx);
SetVector<StringRef> &serializationCtx);

LogicalResult prepareFunctionType(Location loc, FunctionType type,
spirv::Opcode &typeEnum,
Expand Down Expand Up @@ -292,8 +292,7 @@ class Serializer {
/// Serializes an operation in the SPIR-V dialect that is a mirror of an
/// instruction in the SPIR-V spec. This is auto generated if hasOpcode == 1
/// and autogenSerialization == 1 in ODS.
template <typename OpTy>
LogicalResult processOp(OpTy op) {
template <typename OpTy> LogicalResult processOp(OpTy op) {
return op.emitError("unsupported op serialization");
}

Expand Down
2 changes: 0 additions & 2 deletions mlir/lib/Transforms/LoopFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include <sstream>
#define DEBUG_TYPE "affine-loop-fusion"

using llvm::SetVector;

using namespace mlir;

namespace {
Expand Down
10 changes: 4 additions & 6 deletions mlir/lib/Transforms/Utils/DialectConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ computeConversionSet(iterator_range<Region::iterator> region,

/// A utility function to log a successful result for the given reason.
template <typename... Args>
static void logSuccess(llvm::ScopedPrinter &os, StringRef fmt,
Args &&... args) {
static void logSuccess(llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) {
LLVM_DEBUG({
os.unindent();
os.startLine() << "} -> SUCCESS";
Expand All @@ -89,8 +88,7 @@ static void logSuccess(llvm::ScopedPrinter &os, StringRef fmt,

/// A utility function to log a failure result for the given reason.
template <typename... Args>
static void logFailure(llvm::ScopedPrinter &os, StringRef fmt,
Args &&... args) {
static void logFailure(llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) {
LLVM_DEBUG({
os.unindent();
os.startLine() << "} -> FAILURE : "
Expand Down Expand Up @@ -831,7 +829,7 @@ struct ConversionPatternRewriterImpl {
/// define non-empty regions to the set, but not any of the others. This
/// simplifies the amount of memory needed as we can query if the parent
/// operation was ignored.
llvm::SetVector<Operation *> ignoredOps;
SetVector<Operation *> ignoredOps;

/// A transaction state for each of operations that were updated in-place.
SmallVector<OperationTransactionState, 4> rootUpdates;
Expand Down Expand Up @@ -1959,7 +1957,7 @@ void OperationLegalizer::buildLegalizationGraph(
// A mapping between an operation and any currently invalid patterns it has.
DenseMap<OperationName, SmallPtrSet<const Pattern *, 2>> invalidPatterns;
// A worklist of patterns to consider for legality.
llvm::SetVector<const Pattern *> patternWorklist;
SetVector<const Pattern *> patternWorklist;

// Build the mapping from operations to the parent ops that may generate them.
applicator.walkAllPatterns([&](const Pattern &pattern) {
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Transforms/Utils/LoopUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#define DEBUG_TYPE "LoopUtils"

using namespace mlir;
using llvm::SetVector;
using llvm::SmallMapVector;

namespace {
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Transforms/Utils/RegionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ void mlir::visitUsedValuesDefinedAbove(
}

void mlir::getUsedValuesDefinedAbove(Region &region, Region &limit,
llvm::SetVector<Value> &values) {
SetVector<Value> &values) {
visitUsedValuesDefinedAbove(region, limit, [&](OpOperand *operand) {
values.insert(operand->get());
});
}

void mlir::getUsedValuesDefinedAbove(MutableArrayRef<Region> regions,
llvm::SetVector<Value> &values) {
SetVector<Value> &values) {
for (Region &region : regions)
getUsedValuesDefinedAbove(region, region, values);
}
Expand Down
2 changes: 0 additions & 2 deletions mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

using namespace mlir;

using llvm::SetVector;

static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options");

static llvm::cl::list<int> clTestVectorShapeRatio(
Expand Down
8 changes: 4 additions & 4 deletions mlir/test/lib/Dialect/Test/TestTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void TestDialect::registerTypes() {
}

static Type parseTestType(MLIRContext *ctxt, DialectAsmParser &parser,
llvm::SetVector<Type> &stack) {
SetVector<Type> &stack) {
StringRef typeTag;
if (failed(parser.parseKeyword(&typeTag)))
return Type();
Expand Down Expand Up @@ -270,12 +270,12 @@ static Type parseTestType(MLIRContext *ctxt, DialectAsmParser &parser,
}

Type TestDialect::parseType(DialectAsmParser &parser) const {
llvm::SetVector<Type> stack;
SetVector<Type> stack;
return parseTestType(getContext(), parser, stack);
}

static void printTestType(Type type, DialectAsmPrinter &printer,
llvm::SetVector<Type> &stack) {
SetVector<Type> &stack) {
if (succeeded(generatedTypePrinter(type, printer)))
return;

Expand All @@ -291,6 +291,6 @@ static void printTestType(Type type, DialectAsmPrinter &printer,
}

void TestDialect::printType(Type type, DialectAsmPrinter &printer) const {
llvm::SetVector<Type> stack;
SetVector<Type> stack;
printTestType(type, printer, stack);
}
2 changes: 1 addition & 1 deletion mlir/test/lib/IR/TestSlicing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static LogicalResult createBackwardSliceFunction(Operation *op,
builder.setInsertionPointToEnd(clonedFuncOp.addEntryBlock());
for (auto arg : enumerate(parentFuncOp.getArguments()))
mapper.map(arg.value(), clonedFuncOp.getArgument(arg.index()));
llvm::SetVector<Operation *> slice;
SetVector<Operation *> slice;
getBackwardSlice(op, &slice);
for (Operation *slicedOp : slice)
builder.clone(*slicedOp, mapper);
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Transforms/TestLinalgElementwiseFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace mlir {

static void addOperands(Operation *op, llvm::SetVector<Value> &operandSet) {
static void addOperands(Operation *op, SetVector<Value> &operandSet) {
if (!op)
return;
TypeSwitch<Operation *, void>(op)
Expand All @@ -35,7 +35,7 @@ static void addOperands(Operation *op, llvm::SetVector<Value> &operandSet) {
template <int limit = 3>
static bool setFusedOpOperandLimit(const OpResult &producer,
const OpOperand &consumer) {
llvm::SetVector<Value> fusedOpOperands;
SetVector<Value> fusedOpOperands;
if (producer.getOwner()->getNumResults() != 1)
return false;
addOperands(consumer.getOwner(), fusedOpOperands);
Expand Down
10 changes: 3 additions & 7 deletions mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ static llvm::cl::opt<bool> testEmitIncludeTdHeader(
"tblgen testing."),
llvm::cl::init(false), llvm::cl::cat(ODSGenCat));

using llvm::SetVector;
using llvm::SMLoc;
using llvm::StringRef;
using llvm::Twine;
Expand Down Expand Up @@ -1010,8 +1009,7 @@ struct TensorUse : public Expression {

/// Visitation function. Performs preorder or postorder traversal depending on
/// `PreOrder` and applies `callback` on each node.
template <typename Lambda, bool PreOrder>
void visit(Lambda callback) const;
template <typename Lambda, bool PreOrder> void visit(Lambda callback) const;

StringRef tensorId;
AffineMap indexingMap;
Expand Down Expand Up @@ -1055,8 +1053,7 @@ struct TensorExpr : public Expression {

/// Visitation function. Performs preorder or postorder traversal depending on
/// `PreOrder` and applies `callback` on each node.
template <typename Lambda, bool PreOrder>
void visit(Lambda callback) const;
template <typename Lambda, bool PreOrder> void visit(Lambda callback) const;

StringRef operationName;
SmallVector<std::unique_ptr<Expression>, 4> expressions;
Expand Down Expand Up @@ -1204,8 +1201,7 @@ class TCParser {

namespace llvm {

template <>
struct DenseMapInfo<TensorUse> {
template <> struct DenseMapInfo<TensorUse> {
static TensorUse getEmptyKey() { return TensorUse("", AffineMap()); }
static TensorUse getTombstoneKey() {
return TensorUse(DenseMapInfo<StringRef>::getTombstoneKey(),
Expand Down