diff --git a/mlir/include/mlir/Analysis/CallGraph.h b/mlir/include/mlir/Analysis/CallGraph.h --- a/mlir/include/mlir/Analysis/CallGraph.h +++ b/mlir/include/mlir/Analysis/CallGraph.h @@ -139,8 +139,8 @@ Region *callableRegion; /// A set of out-going edges from this node to other nodes in the graph. - llvm::SetVector, - llvm::SmallDenseSet> + SetVector, + llvm::SmallDenseSet> edges; // Provide access to private methods. diff --git a/mlir/include/mlir/Analysis/SliceAnalysis.h b/mlir/include/mlir/Analysis/SliceAnalysis.h --- a/mlir/include/mlir/Analysis/SliceAnalysis.h +++ b/mlir/include/mlir/Analysis/SliceAnalysis.h @@ -68,12 +68,12 @@ /// 2. reversing the result of 1. gives: /// {4, 3, 6, 2, 1, 5, 8, 7, 9} /// -void getForwardSlice(Operation *op, llvm::SetVector *forwardSlice, +void getForwardSlice(Operation *op, SetVector *forwardSlice, TransitiveFilter filter = nullptr /* pass-through*/); /// Value-rooted version of `getForwardSlice`. Return the union of all forward /// slices for the uses of the value `root`. -void getForwardSlice(Value root, llvm::SetVector *forwardSlice, +void getForwardSlice(Value root, SetVector *forwardSlice, TransitiveFilter filter = nullptr /* pass-through*/); /// Fills `backwardSlice` with the computed backward slice (i.e. @@ -110,17 +110,16 @@ /// Assuming all local orders match the numbering order: /// {1, 2, 5, 3, 4, 6} /// -void getBackwardSlice(Operation *op, - llvm::SetVector *backwardSlice, +void getBackwardSlice(Operation *op, SetVector *backwardSlice, TransitiveFilter filter = nullptr /* pass-through*/); /// Value-rooted version of `getBackwardSlice`. Return the union of all backward /// slices for the op defining or owning the value `root`. -void getBackwardSlice(Value root, llvm::SetVector *backwardSlice, +void getBackwardSlice(Value root, SetVector *backwardSlice, TransitiveFilter filter = nullptr /* pass-through*/); /// Iteratively computes backward slices and forward slices until -/// a fixed point is reached. Returns an `llvm::SetVector` which +/// a fixed point is reached. Returns an `SetVector` which /// **includes** the original operation. /// /// This allows building a slice (i.e. multi-root DAG where everything @@ -196,7 +195,7 @@ /// and keep things ordered but this is still hand-wavy and not worth the /// trouble for now: punt to a simple worklist-based solution. /// -llvm::SetVector +SetVector getSlice(Operation *op, TransitiveFilter backwardFilter = nullptr /* pass-through*/, TransitiveFilter forwardFilter = nullptr /* pass-through*/); @@ -204,8 +203,7 @@ /// Multi-root DAG topological sort. /// Performs a topological sort of the Operation in the `toSort` SetVector. /// Returns a topologically sorted SetVector. -llvm::SetVector -topologicalSort(const llvm::SetVector &toSort); +SetVector topologicalSort(const SetVector &toSort); } // end namespace mlir diff --git a/mlir/include/mlir/IR/SymbolTable.h b/mlir/include/mlir/IR/SymbolTable.h --- a/mlir/include/mlir/IR/SymbolTable.h +++ b/mlir/include/mlir/IR/SymbolTable.h @@ -295,7 +295,7 @@ SymbolTableCollection &symbolTable; /// A map of symbol operations to symbol users. - DenseMap> symbolToUsers; + DenseMap> symbolToUsers; }; //===----------------------------------------------------------------------===// @@ -334,8 +334,7 @@ Operation *lookupSymbol(SymbolRefAttr symbol) { return mlir::SymbolTable::lookupSymbolIn(this->getOperation(), symbol); } - template - T lookupSymbol(SymbolRefAttr symbol) { + template T lookupSymbol(SymbolRefAttr symbol) { return dyn_cast_or_null(lookupSymbol(symbol)); } }; diff --git a/mlir/include/mlir/Support/LLVM.h b/mlir/include/mlir/Support/LLVM.h --- a/mlir/include/mlir/Support/LLVM.h +++ b/mlir/include/mlir/Support/LLVM.h @@ -22,6 +22,7 @@ // declared, and are effectively language features. #include "llvm/ADT/None.h" #include "llvm/Support/Casting.h" +#include // Workaround for clang-5 (PR41549) #if defined(__clang_major__) @@ -33,8 +34,7 @@ // Forward declarations. namespace llvm { // String types -template -class SmallString; +template class SmallString; class StringRef; class StringLiteral; class Twine; @@ -46,41 +46,27 @@ } // namespace detail template class DenseMap; -template -struct DenseMapInfo; -template -class DenseSet; +template struct DenseMapInfo; +template class DenseSet; class MallocAllocator; -template -class MutableArrayRef; -template -class Optional; -template -class PointerUnion; -template -class SmallPtrSet; -template -class SmallPtrSetImpl; -template -class SmallVector; -template -class SmallVectorImpl; -template -class StringSet; -template -class StringSwitch; -template -class TinyPtrVector; -template -class TypeSwitch; +template class MutableArrayRef; +template class Optional; +template class PointerUnion; +template class SetVector; +template class SmallPtrSet; +template class SmallPtrSetImpl; +template class SmallVector; +template class SmallVectorImpl; +template class StringSet; +template class StringSwitch; +template class TinyPtrVector; +template class TypeSwitch; // Other common classes. class APInt; class APFloat; -template -class function_ref; -template -class iterator_range; +template class function_ref; +template class iterator_range; class raw_ostream; } // end namespace llvm @@ -110,6 +96,9 @@ using DenseMap = llvm::DenseMap; template > using DenseSet = llvm::DenseSet; +template , + typename Set = DenseSet> +using SetVector = llvm::SetVector; template using StringSet = llvm::StringSet; using llvm::MutableArrayRef; @@ -129,8 +118,7 @@ // Other common classes. using llvm::APFloat; using llvm::APInt; -template -using function_ref = llvm::function_ref; +template using function_ref = llvm::function_ref; using llvm::iterator_range; using llvm::raw_ostream; } // namespace mlir diff --git a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h --- a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h +++ b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h @@ -242,7 +242,7 @@ void connectPHINodes(Region ®ion, const ModuleTranslation &state); /// Get a topologically sorted list of blocks of the given region. -llvm::SetVector getTopologicallySortedBlocks(Region ®ion); +SetVector getTopologicallySortedBlocks(Region ®ion); /// Create an LLVM IR constant of `llvmType` from the MLIR attribute `attr`. /// This currently supports integer, floating point, splat and dense element diff --git a/mlir/include/mlir/Transforms/RegionUtils.h b/mlir/include/mlir/Transforms/RegionUtils.h --- a/mlir/include/mlir/Transforms/RegionUtils.h +++ b/mlir/include/mlir/Transforms/RegionUtils.h @@ -44,12 +44,12 @@ /// Fill `values` with a list of values defined at the ancestors of the `limit` /// region and used within `region` or its descendants. void getUsedValuesDefinedAbove(Region ®ion, Region &limit, - llvm::SetVector &values); + SetVector &values); /// Fill `values` with a list of values used within any of the regions provided /// but defined in one of the ancestors. void getUsedValuesDefinedAbove(MutableArrayRef regions, - llvm::SetVector &values); + SetVector &values); /// Run a set of structural simplifications over the given regions. This /// includes transformations like unreachable block elimination, dead argument diff --git a/mlir/lib/Analysis/Liveness.cpp b/mlir/lib/Analysis/Liveness.cpp --- a/mlir/lib/Analysis/Liveness.cpp +++ b/mlir/lib/Analysis/Liveness.cpp @@ -128,7 +128,7 @@ /// Builds the internal liveness block mapping. static void buildBlockMapping(Operation *operation, DenseMap &builders) { - llvm::SetVector toProcess; + SetVector toProcess; operation->walk([&](Block *block) { BlockInfoBuilder &builder = diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp --- a/mlir/lib/Analysis/SliceAnalysis.cpp +++ b/mlir/lib/Analysis/SliceAnalysis.cpp @@ -25,8 +25,6 @@ using namespace mlir; -using llvm::SetVector; - static void getForwardSliceImpl(Operation *op, SetVector *forwardSlice, TransitiveFilter filter) { diff --git a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp --- a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp +++ b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp @@ -131,7 +131,7 @@ /// The set of operation values whose whose location will be used for newly /// generated operations. - llvm::SetVector locOps; + SetVector locOps; }; } // end anonymous namespace diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp --- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp +++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp @@ -182,8 +182,8 @@ Location loc = execute.getLoc(); // Collect all outlined function inputs. - llvm::SetVector functionInputs(execute.dependencies().begin(), - execute.dependencies().end()); + SetVector functionInputs(execute.dependencies().begin(), + execute.dependencies().end()); functionInputs.insert(execute.operands().begin(), execute.operands().end()); getUsedValuesDefinedAbove(execute.body(), functionInputs); diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp --- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp @@ -74,9 +74,8 @@ /// is updated with results that will be available after sinking the identified /// ops. static bool -extractBeneficiaryOps(Operation *op, - llvm::SetVector existingDependencies, - llvm::SetVector &beneficiaryOps, +extractBeneficiaryOps(Operation *op, SetVector existingDependencies, + SetVector &beneficiaryOps, llvm::SmallPtrSetImpl &availableValues) { if (beneficiaryOps.count(op)) return true; @@ -109,10 +108,10 @@ // Identify uses from values defined outside of the scope of the launch // operation. - llvm::SetVector sinkCandidates; + SetVector sinkCandidates; getUsedValuesDefinedAbove(launchOpBody, sinkCandidates); - llvm::SetVector toBeSunk; + SetVector toBeSunk; llvm::SmallPtrSet availableValues; for (Value operand : sinkCandidates) { Operation *operandOp = operand.getDefiningOp(); @@ -138,7 +137,7 @@ /// `gpu.terminator` operations by `gpu.return` in the generated function. static gpu::GPUFuncOp outlineKernelFuncImpl(gpu::LaunchOp launchOp, StringRef kernelFnName, - llvm::SetVector &operands) { + SetVector &operands) { Location loc = launchOp.getLoc(); // Create a builder with no insertion point, insertion will happen separately // due to symbol table manipulation. @@ -200,7 +199,7 @@ llvm::SmallVectorImpl &operands) { DenseSet inputOperandSet; inputOperandSet.insert(operands.begin(), operands.end()); - llvm::SetVector operandSet(operands.begin(), operands.end()); + SetVector operandSet(operands.begin(), operands.end()); auto funcOp = outlineKernelFuncImpl(launchOp, kernelFnName, operandSet); for (auto operand : operandSet) { if (!inputOperandSet.count(operand)) @@ -242,7 +241,7 @@ // Insert just after the function. Block::iterator insertPt(func->getNextNode()); auto funcWalkResult = func.walk([&](gpu::LaunchOp op) { - llvm::SetVector operands; + SetVector operands; std::string kernelFnName = Twine(op->getParentOfType().getName(), "_kernel").str(); diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp @@ -59,7 +59,7 @@ // dispatch. We maintain the invariant of this storage being modified // exclusively in this function, and at most one name being added per call. // TODO: consider having such functionality inside DialectAsmPrinter. - thread_local llvm::SetVector knownStructNames; + thread_local SetVector knownStructNames; unsigned stackSize = knownStructNames.size(); (void)stackSize; auto guard = llvm::make_scope_exit([&]() { @@ -323,7 +323,7 @@ // dispatch. We maintain the invariant of this storage being modified // exclusively in this function, and at most one name being added per call. // TODO: consider having such functionality inside DialectAsmParser. - thread_local llvm::SetVector knownStructNames; + thread_local SetVector knownStructNames; unsigned stackSize = knownStructNames.size(); (void)stackSize; auto guard = llvm::make_scope_exit([&]() { diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp @@ -412,7 +412,7 @@ LLVM_DEBUG(DBGS() << "Candidate read: " << *transferRead.getOperation() << "\n"); - llvm::SetVector forwardSlice; + SetVector forwardSlice; getForwardSlice(transferRead.getOperation(), &forwardSlice); // Look for the last TransferWriteOp in the forwardSlice of @@ -510,7 +510,7 @@ template static bool backwardsSliceOnlyHasOpsOfType(scf::ForOp outerLimit, Value v) { // Compute a backward slice up to, but not including, `outerLimit`. - llvm::SetVector backwardSlice; + SetVector backwardSlice; getBackwardSlice(v, &backwardSlice, [&](Operation *op) { return outerLimit->isProperAncestor(op); }); @@ -557,7 +557,7 @@ (void)ok; // Compute a backward slice up to, but not including, `outer`. - llvm::SetVector backwardSlice; + SetVector backwardSlice; getBackwardSlice(v, &backwardSlice, [&](Operation *op) { return outer->isProperAncestor(op); }); backwardSlice.insert(v.getDefiningOp()); @@ -655,8 +655,8 @@ /// dimensions of reuse. static LogicalResult hoistPaddingOnTensorsPrerequisites(linalg::PadTensorOp padTensorOp, int nLevels, - llvm::SetVector &backwardSlice, - llvm::SetVector &packingLoops, + SetVector &backwardSlice, + SetVector &packingLoops, SmallVector &dynamicTensorSizes) { // Bail on any use that isn't an input of a Linalg op. // Hoisting of inplace updates happens after vectorization. @@ -746,7 +746,7 @@ LogicalResult mlir::linalg::hoistPaddingOnTensors(PadTensorOp &padTensorOp, unsigned nLoops) { SmallVector dynamicTensorSizes; - llvm::SetVector backwardSlice, packingLoops; + SetVector backwardSlice, packingLoops; if (failed(hoistPaddingOnTensorsPrerequisites(padTensorOp, nLoops, backwardSlice, packingLoops, dynamicTensorSizes))) diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp @@ -223,14 +223,12 @@ /// 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 -Attribute getPadValueAttr(Type type) { +template Attribute getPadValueAttr(Type type) { llvm_unreachable("Unexpected op type for getPadValueAttr"); return {}; } -template <> -Attribute getPadValueAttr(Type type) { +template <> Attribute getPadValueAttr(Type type) { auto &b = ScopedContext::getBuilderRef(); if (auto floatType = type.dyn_cast()) { return b.getFloatAttr( @@ -248,8 +246,7 @@ return {}; } -template <> -Attribute getPadValueAttr(Type type) { +template <> Attribute getPadValueAttr(Type type) { auto &b = ScopedContext::getBuilderRef(); if (auto floatType = type.dyn_cast()) { return b.getFloatAttr(floatType, @@ -266,14 +263,12 @@ return {}; } -template <> -Attribute getPadValueAttr(Type type) { +template <> Attribute getPadValueAttr(Type type) { auto &b = ScopedContext::getBuilderRef(); return b.getZeroAttr(type); } -template <> -Attribute getPadValueAttr(Type type) { +template <> Attribute getPadValueAttr(Type type) { auto &b = ScopedContext::getBuilderRef(); return b.getZeroAttr(type); } @@ -324,8 +319,7 @@ } } -template -static bool hasPadding(PoolingOp poolingOp) { +template 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; @@ -501,7 +495,7 @@ }); // 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 loopSet; + SetVector loopSet; for (Value iv : allIvs) { if (!iv) return {}; diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @@ -206,7 +206,7 @@ // This later folds away. SmallVector paddedSubviewResults; paddedSubviewResults.reserve(opToPad->getNumResults()); - llvm::SetVector newUsersOfOpToPad; + SetVector newUsersOfOpToPad; for (auto it : llvm::zip(opToPad->getResults(), paddedOp->getResults())) { auto rank = std::get<0>(it).getType().cast().getRank(); SmallVector offsets(rank, rewriter.getIndexAttr(0)); diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @@ -40,8 +40,7 @@ /// Return the unique instance of OpType in `block` if it is indeed unique. /// Return null if none or more than 1 instances exist. -template -static OpType getSingleOpOfType(Block &block) { +template static OpType getSingleOpOfType(Block &block) { OpType res; block.walk([&](OpType op) { if (res) { @@ -307,7 +306,7 @@ BlockAndValueMapping bvm; // 2. Values defined above the region can only be broadcast for now. Make them // map to themselves. - llvm::SetVector valuesSet; + SetVector valuesSet; mlir::getUsedValuesDefinedAbove(linalgOp->getRegion(0), valuesSet); bvm.map(valuesSet.getArrayRef(), valuesSet.getArrayRef()); diff --git a/mlir/lib/Dialect/SCF/Transforms/Utils.cpp b/mlir/lib/Dialect/SCF/Transforms/Utils.cpp --- a/mlir/lib/Dialect/SCF/Transforms/Utils.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/Utils.cpp @@ -91,7 +91,7 @@ OpBuilder::InsertionGuard g(b); b.setInsertionPoint(ifOp->getParentOfType()); - llvm::SetVector captures; + SetVector captures; getUsedValuesDefinedAbove(ifOrElseRegion, captures); ValueRange values(captures.getArrayRef()); diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp @@ -481,8 +481,7 @@ // 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 -struct ParseCommaSeparatedList { +template struct ParseCommaSeparatedList { Optional> operator()(SPIRVDialect const &dialect, DialectAsmParser &parser) const { auto parseVal = parseAndVerify(dialect, parser); @@ -502,8 +501,7 @@ // Partial specialization of the function to parse a comma separated list of // specs to parse the last element of the list. -template -struct ParseCommaSeparatedList { +template struct ParseCommaSeparatedList { Optional> operator()(SPIRVDialect const &dialect, DialectAsmParser &parser) const { if (auto value = parseAndVerify(dialect, parser)) @@ -636,15 +634,15 @@ // // Note: This has to be thread_local to enable multiple threads to safely // parse concurrently. - thread_local llvm::SetVector structContext; + thread_local SetVector structContext; - static auto removeIdentifierAndFail = - [](llvm::SetVector &structContext, StringRef identifier) { - if (!identifier.empty()) - structContext.remove(identifier); + static auto removeIdentifierAndFail = [](SetVector &structContext, + StringRef identifier) { + if (!identifier.empty()) + structContext.remove(identifier); - return Type(); - }; + return Type(); + }; if (parser.parseLess()) return Type(); @@ -801,7 +799,7 @@ } static void print(StructType type, DialectAsmPrinter &os) { - thread_local llvm::SetVector structContext; + thread_local SetVector structContext; os << "struct<"; diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp @@ -83,7 +83,7 @@ SmallVector spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) { ArrayRef directCaps = getDirectImpliedCapabilities(cap); - llvm::SetVector> allCaps( + SetVector> allCaps( directCaps.begin(), directCaps.end()); // TODO: This is insufficient; find a better way to handle this diff --git a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp @@ -74,7 +74,7 @@ if (!module) { return failure(); } - llvm::SetVector interfaceVarSet; + SetVector interfaceVarSet; // TODO: This should in reality traverse the entry function // call graph and collect all the interfaces. For now, just traverse the diff --git a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp @@ -42,7 +42,7 @@ static LogicalResult checkAndUpdateExtensionRequirements( Operation *op, const spirv::TargetEnv &targetEnv, const spirv::SPIRVType::ExtensionArrayRefVector &candidates, - llvm::SetVector &deducedExtensions) { + SetVector &deducedExtensions) { for (const auto &ors : candidates) { if (Optional chosen = targetEnv.allows(ors)) { deducedExtensions.insert(*chosen); @@ -70,7 +70,7 @@ static LogicalResult checkAndUpdateCapabilityRequirements( Operation *op, const spirv::TargetEnv &targetEnv, const spirv::SPIRVType::CapabilityArrayRefVector &candidates, - llvm::SetVector &deducedCapabilities) { + SetVector &deducedCapabilities) { for (const auto &ors : candidates) { if (Optional chosen = targetEnv.allows(ors)) { deducedCapabilities.insert(*chosen); @@ -101,8 +101,8 @@ spirv::Version allowedVersion = targetAttr.getVersion(); spirv::Version deducedVersion = spirv::Version::V_1_0; - llvm::SetVector deducedExtensions; - llvm::SetVector deducedCapabilities; + SetVector deducedExtensions; + SetVector deducedCapabilities; // Walk each SPIR-V op to deduce the minimal version/extension/capability // requirements. diff --git a/mlir/lib/Dialect/Vector/VectorUtils.cpp b/mlir/lib/Dialect/Vector/VectorUtils.cpp --- a/mlir/lib/Dialect/Vector/VectorUtils.cpp +++ b/mlir/lib/Dialect/Vector/VectorUtils.cpp @@ -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. diff --git a/mlir/lib/IR/SymbolTable.cpp b/mlir/lib/IR/SymbolTable.cpp --- a/mlir/lib/IR/SymbolTable.cpp +++ b/mlir/lib/IR/SymbolTable.cpp @@ -601,8 +601,8 @@ assert(!symbol->hasTrait() || symbol != limit); // Compute the ancestors of 'limit'. - llvm::SetVector, - SmallPtrSet> + SetVector, + SmallPtrSet> limitAncestors; Operation *limitAncestor = limit; do { @@ -1043,7 +1043,7 @@ auto it = symbolToUsers.find(symbol); if (it == symbolToUsers.end()) return; - llvm::SetVector &users = it->second; + SetVector &users = it->second; // Replace the uses within the users of `symbol`. for (Operation *user : users) diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -44,7 +44,7 @@ // Convert blocks one by one in topological order to ensure // defs are converted before uses. - llvm::SetVector blocks = + SetVector blocks = LLVM::detail::getTopologicallySortedBlocks(region); for (Block *bb : blocks) { llvm::BasicBlock *llvmBB = moduleTranslation.lookupBlock(bb); diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -275,11 +275,11 @@ } /// Sort function blocks topologically. -llvm::SetVector +SetVector mlir::LLVM::detail::getTopologicallySortedBlocks(Region ®ion) { // 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 blocks; + SetVector blocks; for (Block &b : region) { if (blocks.count(&b) == 0) { llvm::ReversePostOrderTraversal traversal(&b); diff --git a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.h b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.h --- a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.h +++ b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.h @@ -608,7 +608,7 @@ /// A list of IDs for all types forward-declared through OpTypeForwardPointer /// instructions. - llvm::SetVector typeForwardPointerIDs; + SetVector typeForwardPointerIDs; /// A list of all structs which have unresolved member types. SmallVector deferredStructTypesInfos; diff --git a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp --- a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp +++ b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp @@ -1630,7 +1630,7 @@ Block *mergeBlock; Block *continueBlock; // nullptr for spv.mlir.selection - llvm::SetVector constructBlocks; + SetVector constructBlocks; }; } // namespace diff --git a/mlir/lib/Target/SPIRV/Serialization/Serializer.h b/mlir/lib/Target/SPIRV/Serialization/Serializer.h --- a/mlir/lib/Target/SPIRV/Serialization/Serializer.h +++ b/mlir/lib/Target/SPIRV/Serialization/Serializer.h @@ -165,7 +165,7 @@ /// 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 &serializationCtx); + SetVector &serializationCtx); /// Method for preparing basic SPIR-V type serialization. Returns the type's /// opcode and operands for the instruction via `typeEnum` and `operands`. @@ -173,7 +173,7 @@ spirv::Opcode &typeEnum, SmallVectorImpl &operands, bool &deferSerialization, - llvm::SetVector &serializationCtx); + SetVector &serializationCtx); LogicalResult prepareFunctionType(Location loc, FunctionType type, spirv::Opcode &typeEnum, @@ -292,8 +292,7 @@ /// 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 - LogicalResult processOp(OpTy op) { + template LogicalResult processOp(OpTy op) { return op.emitError("unsupported op serialization"); } diff --git a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp --- a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp +++ b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp @@ -321,13 +321,13 @@ uint32_t &typeID) { // Maintains a set of names for nested identified struct types. This is used // to properly serialize recursive references. - llvm::SetVector serializationCtx; + SetVector serializationCtx; return processTypeImpl(loc, type, typeID, serializationCtx); } LogicalResult Serializer::processTypeImpl(Location loc, Type type, uint32_t &typeID, - llvm::SetVector &serializationCtx) { + SetVector &serializationCtx) { typeID = getTypeID(type); if (typeID) { return success(); @@ -380,7 +380,7 @@ LogicalResult Serializer::prepareBasicType( Location loc, Type type, uint32_t resultID, spirv::Opcode &typeEnum, SmallVectorImpl &operands, bool &deferSerialization, - llvm::SetVector &serializationCtx) { + SetVector &serializationCtx) { deferSerialization = false; if (isVoidType(type)) { diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp --- a/mlir/lib/Transforms/LoopFusion.cpp +++ b/mlir/lib/Transforms/LoopFusion.cpp @@ -34,8 +34,6 @@ #include #define DEBUG_TYPE "affine-loop-fusion" -using llvm::SetVector; - using namespace mlir; namespace { diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp --- a/mlir/lib/Transforms/Utils/DialectConversion.cpp +++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp @@ -75,8 +75,7 @@ /// A utility function to log a successful result for the given reason. template -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"; @@ -89,8 +88,7 @@ /// A utility function to log a failure result for the given reason. template -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 : " @@ -831,7 +829,7 @@ /// 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 ignoredOps; + SetVector ignoredOps; /// A transaction state for each of operations that were updated in-place. SmallVector rootUpdates; @@ -1959,7 +1957,7 @@ // A mapping between an operation and any currently invalid patterns it has. DenseMap> invalidPatterns; // A worklist of patterns to consider for legality. - llvm::SetVector patternWorklist; + SetVector patternWorklist; // Build the mapping from operations to the parent ops that may generate them. applicator.walkAllPatterns([&](const Pattern &pattern) { diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -38,7 +38,6 @@ #define DEBUG_TYPE "LoopUtils" using namespace mlir; -using llvm::SetVector; using llvm::SmallMapVector; namespace { diff --git a/mlir/lib/Transforms/Utils/RegionUtils.cpp b/mlir/lib/Transforms/Utils/RegionUtils.cpp --- a/mlir/lib/Transforms/Utils/RegionUtils.cpp +++ b/mlir/lib/Transforms/Utils/RegionUtils.cpp @@ -57,14 +57,14 @@ } void mlir::getUsedValuesDefinedAbove(Region ®ion, Region &limit, - llvm::SetVector &values) { + SetVector &values) { visitUsedValuesDefinedAbove(region, limit, [&](OpOperand *operand) { values.insert(operand->get()); }); } void mlir::getUsedValuesDefinedAbove(MutableArrayRef regions, - llvm::SetVector &values) { + SetVector &values) { for (Region ®ion : regions) getUsedValuesDefinedAbove(region, region, values); } diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp --- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp +++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp @@ -32,8 +32,6 @@ using namespace mlir; -using llvm::SetVector; - static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options"); static llvm::cl::list clTestVectorShapeRatio( diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -227,7 +227,7 @@ } static Type parseTestType(MLIRContext *ctxt, DialectAsmParser &parser, - llvm::SetVector &stack) { + SetVector &stack) { StringRef typeTag; if (failed(parser.parseKeyword(&typeTag))) return Type(); @@ -270,12 +270,12 @@ } Type TestDialect::parseType(DialectAsmParser &parser) const { - llvm::SetVector stack; + SetVector stack; return parseTestType(getContext(), parser, stack); } static void printTestType(Type type, DialectAsmPrinter &printer, - llvm::SetVector &stack) { + SetVector &stack) { if (succeeded(generatedTypePrinter(type, printer))) return; @@ -291,6 +291,6 @@ } void TestDialect::printType(Type type, DialectAsmPrinter &printer) const { - llvm::SetVector stack; + SetVector stack; printTestType(type, printer, stack); } diff --git a/mlir/test/lib/IR/TestSlicing.cpp b/mlir/test/lib/IR/TestSlicing.cpp --- a/mlir/test/lib/IR/TestSlicing.cpp +++ b/mlir/test/lib/IR/TestSlicing.cpp @@ -35,7 +35,7 @@ builder.setInsertionPointToEnd(clonedFuncOp.addEntryBlock()); for (auto arg : enumerate(parentFuncOp.getArguments())) mapper.map(arg.value(), clonedFuncOp.getArgument(arg.index())); - llvm::SetVector slice; + SetVector slice; getBackwardSlice(op, &slice); for (Operation *slicedOp : slice) builder.clone(*slicedOp, mapper); diff --git a/mlir/test/lib/Transforms/TestLinalgElementwiseFusion.cpp b/mlir/test/lib/Transforms/TestLinalgElementwiseFusion.cpp --- a/mlir/test/lib/Transforms/TestLinalgElementwiseFusion.cpp +++ b/mlir/test/lib/Transforms/TestLinalgElementwiseFusion.cpp @@ -19,7 +19,7 @@ namespace mlir { -static void addOperands(Operation *op, llvm::SetVector &operandSet) { +static void addOperands(Operation *op, SetVector &operandSet) { if (!op) return; TypeSwitch(op) @@ -35,7 +35,7 @@ template static bool setFusedOpOperandLimit(const OpResult &producer, const OpOperand &consumer) { - llvm::SetVector fusedOpOperands; + SetVector fusedOpOperands; if (producer.getOwner()->getNumResults() != 1) return false; addOperands(consumer.getOwner(), fusedOpOperands); diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp --- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp +++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp @@ -64,7 +64,6 @@ "tblgen testing."), llvm::cl::init(false), llvm::cl::cat(ODSGenCat)); -using llvm::SetVector; using llvm::SMLoc; using llvm::StringRef; using llvm::Twine; @@ -1010,8 +1009,7 @@ /// Visitation function. Performs preorder or postorder traversal depending on /// `PreOrder` and applies `callback` on each node. - template - void visit(Lambda callback) const; + template void visit(Lambda callback) const; StringRef tensorId; AffineMap indexingMap; @@ -1055,8 +1053,7 @@ /// Visitation function. Performs preorder or postorder traversal depending on /// `PreOrder` and applies `callback` on each node. - template - void visit(Lambda callback) const; + template void visit(Lambda callback) const; StringRef operationName; SmallVector, 4> expressions; @@ -1204,8 +1201,7 @@ namespace llvm { -template <> -struct DenseMapInfo { +template <> struct DenseMapInfo { static TensorUse getEmptyKey() { return TensorUse("", AffineMap()); } static TensorUse getTombstoneKey() { return TensorUse(DenseMapInfo::getTombstoneKey(),