summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/IR')
-rw-r--r--mlir/lib/IR/AffineExpr.cpp18
-rw-r--r--mlir/lib/IR/AffineMap.cpp8
-rw-r--r--mlir/lib/IR/AsmPrinter.cpp12
-rw-r--r--mlir/lib/IR/Attributes.cpp27
-rw-r--r--mlir/lib/IR/Block.cpp2
-rw-r--r--mlir/lib/IR/Diagnostics.cpp20
-rw-r--r--mlir/lib/IR/Function.cpp6
-rw-r--r--mlir/lib/IR/FunctionImplementation.cpp2
-rw-r--r--mlir/lib/IR/IntegerSet.cpp3
-rw-r--r--mlir/lib/IR/Module.cpp2
-rw-r--r--mlir/lib/IR/Operation.cpp2
-rw-r--r--mlir/lib/IR/Region.cpp4
-rw-r--r--mlir/lib/IR/StandardTypes.cpp9
13 files changed, 55 insertions, 60 deletions
diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp
index 19599a8a62e..009c1a1485c 100644
--- a/mlir/lib/IR/AffineExpr.cpp
+++ b/mlir/lib/IR/AffineExpr.cpp
@@ -866,9 +866,10 @@ AffineExpr mlir::simplifyAffineExpr(AffineExpr expr, unsigned numDims,
// Flattens the expressions in map. Returns true on success or false
// if 'expr' was unable to be flattened (i.e., semi-affine expressions not
// handled yet).
-static bool getFlattenedAffineExprs(
- ArrayRef<AffineExpr> exprs, unsigned numDims, unsigned numSymbols,
- std::vector<llvm::SmallVector<int64_t, 8>> *flattenedExprs) {
+static bool
+getFlattenedAffineExprs(ArrayRef<AffineExpr> exprs, unsigned numDims,
+ unsigned numSymbols,
+ std::vector<SmallVector<int64_t, 8>> *flattenedExprs) {
if (exprs.empty()) {
return true;
}
@@ -894,9 +895,9 @@ static bool getFlattenedAffineExprs(
// Flattens 'expr' into 'flattenedExpr'. Returns true on success or false
// if 'expr' was unable to be flattened (semi-affine expressions not handled
// yet).
-bool mlir::getFlattenedAffineExpr(
- AffineExpr expr, unsigned numDims, unsigned numSymbols,
- llvm::SmallVectorImpl<int64_t> *flattenedExpr) {
+bool mlir::getFlattenedAffineExpr(AffineExpr expr, unsigned numDims,
+ unsigned numSymbols,
+ SmallVectorImpl<int64_t> *flattenedExpr) {
std::vector<SmallVector<int64_t, 8>> flattenedExprs;
bool ret =
::getFlattenedAffineExprs({expr}, numDims, numSymbols, &flattenedExprs);
@@ -908,7 +909,7 @@ bool mlir::getFlattenedAffineExpr(
/// if 'expr' was unable to be flattened (i.e., semi-affine expressions not
/// handled yet).
bool mlir::getFlattenedAffineExprs(
- AffineMap map, std::vector<llvm::SmallVector<int64_t, 8>> *flattenedExprs) {
+ AffineMap map, std::vector<SmallVector<int64_t, 8>> *flattenedExprs) {
if (map.getNumResults() == 0) {
return true;
}
@@ -917,8 +918,7 @@ bool mlir::getFlattenedAffineExprs(
}
bool mlir::getFlattenedAffineExprs(
- IntegerSet set,
- std::vector<llvm::SmallVector<int64_t, 8>> *flattenedExprs) {
+ IntegerSet set, std::vector<SmallVector<int64_t, 8>> *flattenedExprs) {
if (set.getNumConstraints() == 0) {
return true;
}
diff --git a/mlir/lib/IR/AffineMap.cpp b/mlir/lib/IR/AffineMap.cpp
index 98357b1348b..6cfef363985 100644
--- a/mlir/lib/IR/AffineMap.cpp
+++ b/mlir/lib/IR/AffineMap.cpp
@@ -48,7 +48,7 @@ public:
}
private:
- llvm::Optional<int64_t> constantFoldImpl(AffineExpr expr) {
+ Optional<int64_t> constantFoldImpl(AffineExpr expr) {
switch (expr.getKind()) {
case AffineExprKind::Add:
return constantFoldBinExpr(
@@ -83,8 +83,8 @@ private:
}
// TODO: Change these to operate on APInts too.
- llvm::Optional<int64_t> constantFoldBinExpr(AffineExpr expr,
- int64_t (*op)(int64_t, int64_t)) {
+ Optional<int64_t> constantFoldBinExpr(AffineExpr expr,
+ int64_t (*op)(int64_t, int64_t)) {
auto binOpExpr = expr.cast<AffineBinaryOpExpr>();
if (auto lhs = constantFoldImpl(binOpExpr.getLHS()))
if (auto rhs = constantFoldImpl(binOpExpr.getRHS()))
@@ -324,7 +324,7 @@ AffineMap mlir::concatAffineMaps(ArrayRef<AffineMap> maps) {
for (auto m : maps)
numResults += m ? m.getNumResults() : 0;
unsigned numDims = 0;
- llvm::SmallVector<AffineExpr, 8> results;
+ SmallVector<AffineExpr, 8> results;
results.reserve(numResults);
for (auto m : maps) {
if (!m)
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 0ea447ed324..e1903d560b1 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -437,9 +437,9 @@ public:
void printLocation(LocationAttr loc);
void printAffineMap(AffineMap map);
- void printAffineExpr(
- AffineExpr expr,
- llvm::function_ref<void(unsigned, bool)> printValueName = nullptr);
+ void
+ printAffineExpr(AffineExpr expr,
+ function_ref<void(unsigned, bool)> printValueName = nullptr);
void printAffineConstraint(AffineExpr expr, bool isEq);
void printIntegerSet(IntegerSet set);
@@ -463,7 +463,7 @@ protected:
};
void printAffineExprInternal(
AffineExpr expr, BindingStrength enclosingTightness,
- llvm::function_ref<void(unsigned, bool)> printValueName = nullptr);
+ function_ref<void(unsigned, bool)> printValueName = nullptr);
/// The output stream for the printer.
raw_ostream &os;
@@ -1175,13 +1175,13 @@ void ModulePrinter::printDialectType(Type type) {
//===----------------------------------------------------------------------===//
void ModulePrinter::printAffineExpr(
- AffineExpr expr, llvm::function_ref<void(unsigned, bool)> printValueName) {
+ AffineExpr expr, function_ref<void(unsigned, bool)> printValueName) {
printAffineExprInternal(expr, BindingStrength::Weak, printValueName);
}
void ModulePrinter::printAffineExprInternal(
AffineExpr expr, BindingStrength enclosingTightness,
- llvm::function_ref<void(unsigned, bool)> printValueName) {
+ function_ref<void(unsigned, bool)> printValueName) {
const char *binopSpelling = nullptr;
switch (expr.getKind()) {
case AffineExprKind::SymbolId: {
diff --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp
index b546643837b..bb35a63bf5d 100644
--- a/mlir/lib/IR/Attributes.cpp
+++ b/mlir/lib/IR/Attributes.cpp
@@ -405,9 +405,9 @@ bool ElementsAttr::isValidIndex(ArrayRef<uint64_t> index) const {
});
}
-ElementsAttr ElementsAttr::mapValues(
- Type newElementType,
- llvm::function_ref<APInt(const APInt &)> mapping) const {
+ElementsAttr
+ElementsAttr::mapValues(Type newElementType,
+ function_ref<APInt(const APInt &)> mapping) const {
switch (getKind()) {
case StandardAttributes::DenseElements:
return cast<DenseElementsAttr>().mapValues(newElementType, mapping);
@@ -416,9 +416,9 @@ ElementsAttr ElementsAttr::mapValues(
}
}
-ElementsAttr ElementsAttr::mapValues(
- Type newElementType,
- llvm::function_ref<APInt(const APFloat &)> mapping) const {
+ElementsAttr
+ElementsAttr::mapValues(Type newElementType,
+ function_ref<APInt(const APFloat &)> mapping) const {
switch (getKind()) {
case StandardAttributes::DenseElements:
return cast<DenseElementsAttr>().mapValues(newElementType, mapping);
@@ -798,15 +798,14 @@ DenseElementsAttr DenseElementsAttr::reshape(ShapedType newType) {
return getRaw(newType, getRawData(), isSplat());
}
-DenseElementsAttr DenseElementsAttr::mapValues(
- Type newElementType,
- llvm::function_ref<APInt(const APInt &)> mapping) const {
+DenseElementsAttr
+DenseElementsAttr::mapValues(Type newElementType,
+ function_ref<APInt(const APInt &)> mapping) const {
return cast<DenseIntElementsAttr>().mapValues(newElementType, mapping);
}
DenseElementsAttr DenseElementsAttr::mapValues(
- Type newElementType,
- llvm::function_ref<APInt(const APFloat &)> mapping) const {
+ Type newElementType, function_ref<APInt(const APFloat &)> mapping) const {
return cast<DenseFPElementsAttr>().mapValues(newElementType, mapping);
}
@@ -855,8 +854,7 @@ static ShapedType mappingHelper(Fn mapping, Attr &attr, ShapedType inType,
}
DenseElementsAttr DenseFPElementsAttr::mapValues(
- Type newElementType,
- llvm::function_ref<APInt(const APFloat &)> mapping) const {
+ Type newElementType, function_ref<APInt(const APFloat &)> mapping) const {
llvm::SmallVector<char, 8> elementData;
auto newArrayType =
mappingHelper(mapping, *this, getType(), newElementType, elementData);
@@ -875,8 +873,7 @@ bool DenseFPElementsAttr::classof(Attribute attr) {
//===----------------------------------------------------------------------===//
DenseElementsAttr DenseIntElementsAttr::mapValues(
- Type newElementType,
- llvm::function_ref<APInt(const APInt &)> mapping) const {
+ Type newElementType, function_ref<APInt(const APInt &)> mapping) const {
llvm::SmallVector<char, 8> elementData;
auto newArrayType =
mappingHelper(mapping, *this, getType(), newElementType, elementData);
diff --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp
index 63e85802b73..4dac32ae0c0 100644
--- a/mlir/lib/IR/Block.cpp
+++ b/mlir/lib/IR/Block.cpp
@@ -159,7 +159,7 @@ BlockArgument *Block::addArgument(Type type) {
/// Add one argument to the argument list for each type specified in the list.
auto Block::addArguments(ArrayRef<Type> types)
- -> llvm::iterator_range<args_iterator> {
+ -> iterator_range<args_iterator> {
arguments.reserve(arguments.size() + types.size());
auto initialSize = arguments.size();
for (auto type : types) {
diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp
index 70a802cd856..59e16a48865 100644
--- a/mlir/lib/IR/Diagnostics.cpp
+++ b/mlir/lib/IR/Diagnostics.cpp
@@ -104,7 +104,7 @@ void DiagnosticArgument::print(raw_ostream &os) const {
static StringRef twineToStrRef(const Twine &val,
std::vector<std::unique_ptr<char[]>> &strings) {
// Allocate memory to hold this string.
- llvm::SmallString<64> data;
+ SmallString<64> data;
auto strRef = val.toStringRef(data);
strings.push_back(std::unique_ptr<char[]>(new char[strRef.size()]));
memcpy(&strings.back()[0], strRef.data(), strRef.size());
@@ -157,7 +157,7 @@ std::string Diagnostic::str() const {
/// Attaches a note to this diagnostic. A new location may be optionally
/// provided, if not, then the location defaults to the one specified for this
/// diagnostic. Notes may not be attached to other notes.
-Diagnostic &Diagnostic::attachNote(llvm::Optional<Location> noteLoc) {
+Diagnostic &Diagnostic::attachNote(Optional<Location> noteLoc) {
// We don't allow attaching notes to notes.
assert(severity != DiagnosticSeverity::Note &&
"cannot attach a note to a note");
@@ -285,9 +285,8 @@ void DiagnosticEngine::emit(Diagnostic diag) {
/// Helper function used to emit a diagnostic with an optionally empty twine
/// message. If the message is empty, then it is not inserted into the
/// diagnostic.
-static InFlightDiagnostic emitDiag(Location location,
- DiagnosticSeverity severity,
- const llvm::Twine &message) {
+static InFlightDiagnostic
+emitDiag(Location location, DiagnosticSeverity severity, const Twine &message) {
auto &diagEngine = location->getContext()->getDiagEngine();
auto diag = diagEngine.emit(location, severity);
if (!message.isTriviallyEmpty())
@@ -374,7 +373,7 @@ struct SourceMgrDiagnosticHandlerImpl {
} // end namespace mlir
/// Return a processable FileLineColLoc from the given location.
-static llvm::Optional<FileLineColLoc> getFileLineColLoc(Location loc) {
+static Optional<FileLineColLoc> getFileLineColLoc(Location loc) {
switch (loc->getKind()) {
case StandardAttributes::NameLocation:
return getFileLineColLoc(loc.cast<NameLoc>().getChildLoc());
@@ -405,7 +404,7 @@ static llvm::SourceMgr::DiagKind getDiagKind(DiagnosticSeverity kind) {
SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler(llvm::SourceMgr &mgr,
MLIRContext *ctx,
- llvm::raw_ostream &os)
+ raw_ostream &os)
: ScopedDiagnosticHandler(ctx), mgr(mgr), os(os),
impl(new SourceMgrDiagnosticHandlerImpl()) {
setHandler([this](Diagnostic &diag) { emitDiagnostic(diag); });
@@ -556,8 +555,7 @@ struct SourceMgrDiagnosticVerifierHandlerImpl {
SourceMgrDiagnosticVerifierHandlerImpl() : status(success()) {}
/// Returns the expected diagnostics for the given source file.
- llvm::Optional<MutableArrayRef<ExpectedDiag>>
- getExpectedDiags(StringRef bufName);
+ Optional<MutableArrayRef<ExpectedDiag>> getExpectedDiags(StringRef bufName);
/// Computes the expected diagnostics for the given source buffer.
MutableArrayRef<ExpectedDiag>
@@ -592,7 +590,7 @@ static StringRef getDiagKindStr(DiagnosticSeverity kind) {
}
/// Returns the expected diagnostics for the given source file.
-llvm::Optional<MutableArrayRef<ExpectedDiag>>
+Optional<MutableArrayRef<ExpectedDiag>>
SourceMgrDiagnosticVerifierHandlerImpl::getExpectedDiags(StringRef bufName) {
auto expectedDiags = expectedDiagsPerFile.find(bufName);
if (expectedDiags != expectedDiagsPerFile.end())
@@ -681,7 +679,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
}
SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(
- llvm::SourceMgr &srcMgr, MLIRContext *ctx, llvm::raw_ostream &out)
+ llvm::SourceMgr &srcMgr, MLIRContext *ctx, raw_ostream &out)
: SourceMgrDiagnosticHandler(srcMgr, ctx, out),
impl(new SourceMgrDiagnosticVerifierHandlerImpl()) {
// Compute the expected diagnostics for each of the current files in the
diff --git a/mlir/lib/IR/Function.cpp b/mlir/lib/IR/Function.cpp
index e5e854260f3..b51c77f34c2 100644
--- a/mlir/lib/IR/Function.cpp
+++ b/mlir/lib/IR/Function.cpp
@@ -40,10 +40,10 @@ FuncOp FuncOp::create(Location location, StringRef name, FunctionType type,
OperationState state(location, "func");
Builder builder(location->getContext());
FuncOp::build(&builder, state, name, type, attrs);
- return llvm::cast<FuncOp>(Operation::create(state));
+ return cast<FuncOp>(Operation::create(state));
}
FuncOp FuncOp::create(Location location, StringRef name, FunctionType type,
- llvm::iterator_range<dialect_attr_iterator> attrs) {
+ iterator_range<dialect_attr_iterator> attrs) {
SmallVector<NamedAttribute, 8> attrRef(attrs);
return create(location, name, type, llvm::makeArrayRef(attrRef));
}
@@ -204,7 +204,7 @@ FuncOp FuncOp::clone(BlockAndValueMapping &mapper) {
}
// Create the new function.
- FuncOp newFunc = llvm::cast<FuncOp>(getOperation()->cloneWithoutRegions());
+ FuncOp newFunc = cast<FuncOp>(getOperation()->cloneWithoutRegions());
newFunc.setType(newType);
/// Set the argument attributes for arguments that aren't being replaced.
diff --git a/mlir/lib/IR/FunctionImplementation.cpp b/mlir/lib/IR/FunctionImplementation.cpp
index 66c0d8af6d3..9cec216468d 100644
--- a/mlir/lib/IR/FunctionImplementation.cpp
+++ b/mlir/lib/IR/FunctionImplementation.cpp
@@ -213,7 +213,7 @@ mlir::impl::parseFunctionLikeOp(OpAsmParser &parser, OperationState &result,
// Parse the optional function body.
auto *body = result.addRegion();
return parser.parseOptionalRegion(
- *body, entryArgs, entryArgs.empty() ? llvm::ArrayRef<Type>() : argTypes);
+ *body, entryArgs, entryArgs.empty() ? ArrayRef<Type>() : argTypes);
}
// Print a function result list.
diff --git a/mlir/lib/IR/IntegerSet.cpp b/mlir/lib/IR/IntegerSet.cpp
index e5715877649..ce50fa7cc5b 100644
--- a/mlir/lib/IR/IntegerSet.cpp
+++ b/mlir/lib/IR/IntegerSet.cpp
@@ -73,8 +73,7 @@ MLIRContext *IntegerSet::getContext() const {
/// Walk all of the AffineExpr's in this set. Each node in an expression
/// tree is visited in postorder.
-void IntegerSet::walkExprs(
- llvm::function_ref<void(AffineExpr)> callback) const {
+void IntegerSet::walkExprs(function_ref<void(AffineExpr)> callback) const {
for (auto expr : getConstraints())
expr.walk(callback);
}
diff --git a/mlir/lib/IR/Module.cpp b/mlir/lib/IR/Module.cpp
index 79e04521e9c..c52a55b20fe 100644
--- a/mlir/lib/IR/Module.cpp
+++ b/mlir/lib/IR/Module.cpp
@@ -38,7 +38,7 @@ ModuleOp ModuleOp::create(Location loc, Optional<StringRef> name) {
OperationState state(loc, "module");
Builder builder(loc->getContext());
ModuleOp::build(&builder, state, name);
- return llvm::cast<ModuleOp>(Operation::create(state));
+ return cast<ModuleOp>(Operation::create(state));
}
ParseResult ModuleOp::parse(OpAsmParser &parser, OperationState &result) {
diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index fd747a98a40..9df10791046 100644
--- a/mlir/lib/IR/Operation.cpp
+++ b/mlir/lib/IR/Operation.cpp
@@ -1174,7 +1174,7 @@ Value *impl::foldCastOp(Operation *op) {
/// terminator operation to insert.
void impl::ensureRegionTerminator(
Region &region, Location loc,
- llvm::function_ref<Operation *()> buildTerminatorOp) {
+ function_ref<Operation *()> buildTerminatorOp) {
if (region.empty())
region.push_back(new Block);
diff --git a/mlir/lib/IR/Region.cpp b/mlir/lib/IR/Region.cpp
index c588e567bc3..6cec021b6a1 100644
--- a/mlir/lib/IR/Region.cpp
+++ b/mlir/lib/IR/Region.cpp
@@ -129,7 +129,7 @@ void Region::dropAllReferences() {
/// is used to point to the operation containing the region, the actual error is
/// reported at the operation with an offending use.
static bool isIsolatedAbove(Region &region, Region &limit,
- llvm::Optional<Location> noteLoc) {
+ Optional<Location> noteLoc) {
assert(limit.isAncestor(&region) &&
"expected isolation limit to be an ancestor of the given region");
@@ -174,7 +174,7 @@ static bool isIsolatedAbove(Region &region, Region &limit,
return true;
}
-bool Region::isIsolatedFromAbove(llvm::Optional<Location> noteLoc) {
+bool Region::isIsolatedFromAbove(Optional<Location> noteLoc) {
return isIsolatedAbove(*this, *this, noteLoc);
}
diff --git a/mlir/lib/IR/StandardTypes.cpp b/mlir/lib/IR/StandardTypes.cpp
index 8a47c5b0b41..7c494e219e8 100644
--- a/mlir/lib/IR/StandardTypes.cpp
+++ b/mlir/lib/IR/StandardTypes.cpp
@@ -375,7 +375,7 @@ MemRefType MemRefType::getImpl(ArrayRef<int64_t> shape, Type elementType,
// Drop identity maps from the composition.
// This may lead to the composition becoming empty, which is interpreted as an
// implicit identity.
- llvm::SmallVector<AffineMap, 2> cleanedAffineMapComposition;
+ SmallVector<AffineMap, 2> cleanedAffineMapComposition;
for (const auto &map : affineMapComposition) {
if (map.isIdentity())
continue;
@@ -417,7 +417,7 @@ unsigned UnrankedMemRefType::getMemorySpace() const {
}
LogicalResult UnrankedMemRefType::verifyConstructionInvariants(
- llvm::Optional<Location> loc, MLIRContext *context, Type elementType,
+ Optional<Location> loc, MLIRContext *context, Type elementType,
unsigned memorySpace) {
// Check that memref is formed from allowed types.
if (!elementType.isIntOrFloat() && !elementType.isa<VectorType>())
@@ -647,8 +647,9 @@ ComplexType ComplexType::getChecked(Type elementType, Location location) {
}
/// Verify the construction of an integer type.
-LogicalResult ComplexType::verifyConstructionInvariants(
- llvm::Optional<Location> loc, MLIRContext *context, Type elementType) {
+LogicalResult ComplexType::verifyConstructionInvariants(Optional<Location> loc,
+ MLIRContext *context,
+ Type elementType) {
if (!elementType.isa<FloatType>() && !elementType.isa<IntegerType>())
return emitOptionalError(loc, "invalid element type for complex");
return success();
OpenPOWER on IntegriCloud