composeAffineMapAndOperands(&map, &resultOperands);
if (map != oldMap)
return matchSuccess(
- std::make_unique<SimplifyAffineApplyState>(map, resultOperands));
+ llvm::make_unique<SimplifyAffineApplyState>(map, resultOperands));
return matchFailure();
}
void AffineApplyOp::getCanonicalizationPatterns(
OwningRewritePatternList &results, MLIRContext *context) {
- results.push_back(std::make_unique<SimplifyAffineApply>(context));
+ results.push_back(llvm::make_unique<SimplifyAffineApply>(context));
}
//===----------------------------------------------------------------------===//
void AffineForOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
MLIRContext *context) {
- results.push_back(std::make_unique<AffineForLoopBoundFolder>(context));
+ results.push_back(llvm::make_unique<AffineForLoopBoundFolder>(context));
}
Block *AffineForOp::createBody() {
// Clones this object.
std::unique_ptr<FlatAffineConstraints> FlatAffineConstraints::clone() const {
- return std::make_unique<FlatAffineConstraints>(*this);
+ return llvm::make_unique<FlatAffineConstraints>(*this);
}
// Construct from an IntegerSet.
dominanceInfos.clear();
// Build the top level function dominance.
- auto functionDominance = std::make_unique<base>();
+ auto functionDominance = llvm::make_unique<base>();
functionDominance->recalculate(function->getBody());
dominanceInfos.try_emplace(&function->getBody(),
std::move(functionDominance));
// Don't compute dominance if the region is empty.
if (region.empty())
continue;
- auto opDominance = std::make_unique<base>();
+ auto opDominance = llvm::make_unique<base>();
opDominance->recalculate(region);
dominanceInfos.try_emplace(®ion, std::move(opDominance));
}
// Returns a result string which represents the direction vector (if there was
// a dependence), returns the string "false" otherwise.
-static string
+static std::string
getDirectionVectorStr(bool ret, unsigned numCommonLoops, unsigned loopNestDepth,
ArrayRef<DependenceComponent> dependenceComponents) {
if (!ret)
return "false";
if (dependenceComponents.empty() || loopNestDepth > numCommonLoops)
return "true";
- string result;
+ std::string result;
for (unsigned i = 0, e = dependenceComponents.size(); i < e; ++i) {
- string lbStr = "-inf";
+ std::string lbStr = "-inf";
if (dependenceComponents[i].lb.hasValue() &&
dependenceComponents[i].lb.getValue() !=
std::numeric_limits<int64_t>::min())
lbStr = std::to_string(dependenceComponents[i].lb.getValue());
- string ubStr = "+inf";
+ std::string ubStr = "+inf";
if (dependenceComponents[i].ub.hasValue() &&
dependenceComponents[i].ub.getValue() !=
std::numeric_limits<int64_t>::max())
}
// Compute the memref region symbolic in any IVs enclosing this block.
- auto region = std::make_unique<MemRefRegion>(opInst->getLoc());
+ auto region = llvm::make_unique<MemRefRegion>(opInst->getLoc());
if (failed(
region->compute(opInst,
/*loopDepth=*/getNestingDepth(*block.begin())))) {
/// A binary operation appearing in an affine expression.
struct AffineBinaryOpExprStorage : public AffineExprStorage {
+ AffineBinaryOpExprStorage(AffineExprStorage base, AffineExpr lhs,
+ AffineExpr rhs)
+ : AffineExprStorage(base), lhs(lhs), rhs(rhs) {}
static AffineExpr get(AffineExprKind kind, AffineExpr lhs, AffineExpr rhs);
AffineExpr lhs;
AffineExpr rhs;
/// A dimensional identifier appearing in an affine expression.
struct AffineDimExprStorage : public AffineExprStorage {
+ AffineDimExprStorage(AffineExprStorage base, unsigned position)
+ : AffineExprStorage(base), position(position) {}
/// Position of this identifier in the argument list.
unsigned position;
};
/// A symbolic identifier appearing in an affine expression.
struct AffineSymbolExprStorage : public AffineExprStorage {
+ AffineSymbolExprStorage(AffineExprStorage base, unsigned position)
+ : AffineExprStorage(base), position(position) {}
/// Position of this identifier in the symbol list.
unsigned position;
};
/// An integer constant appearing in affine expression.
struct AffineConstantExprStorage : public AffineExprStorage {
+ AffineConstantExprStorage(AffineExprStorage base, int64_t constant)
+ : AffineExprStorage(base), constant(constant) {}
// The constant.
int64_t constant;
};
/// An attribute representing a boolean value.
struct BoolAttributeStorage : public AttributeStorage {
+ BoolAttributeStorage(AttributeStorage base, Type type, bool value)
+ : AttributeStorage(base), type(type), value(value) {}
const Type type;
bool value;
};
/// An attribute representing a string value.
struct StringAttributeStorage : public AttributeStorage {
+ StringAttributeStorage(AttributeStorage base, StringRef value)
+ : AttributeStorage(base), value(value) {}
StringRef value;
};
/// An attribute representing an array of other attributes.
struct ArrayAttributeStorage : public AttributeStorage {
+ ArrayAttributeStorage(AttributeStorage base, ArrayRef<Attribute> value)
+ : AttributeStorage(base), value(value) {}
ArrayRef<Attribute> value;
};
// An attribute representing a reference to an affine map.
struct AffineMapAttributeStorage : public AttributeStorage {
+ AffineMapAttributeStorage(AttributeStorage base, AffineMap value)
+ : AttributeStorage(base), value(value) {}
AffineMap value;
};
// An attribute representing a reference to an integer set.
struct IntegerSetAttributeStorage : public AttributeStorage {
+ IntegerSetAttributeStorage(AttributeStorage base, IntegerSet value)
+ : AttributeStorage(base), value(value) {}
IntegerSet value;
};
/// An attribute representing a reference to a type.
struct TypeAttributeStorage : public AttributeStorage {
+ TypeAttributeStorage(AttributeStorage base, Type value)
+ : AttributeStorage(base), value(value) {}
Type value;
};
/// An attribute representing a reference to a function.
struct FunctionAttributeStorage : public AttributeStorage {
+ FunctionAttributeStorage(AttributeStorage base, Function *value)
+ : AttributeStorage(base), value(value) {}
Function *value;
};
/// A base attribute representing a reference to a vector or tensor constant.
struct ElementsAttributeStorage : public AttributeStorage {
+ ElementsAttributeStorage(AttributeStorage base, VectorOrTensorType type)
+ : AttributeStorage(base), type(type) {}
VectorOrTensorType type;
};
/// An attribute representing a reference to a vector or tensor constant,
/// inwhich all elements have the same value.
struct SplatElementsAttributeStorage : public ElementsAttributeStorage {
+ SplatElementsAttributeStorage(ElementsAttributeStorage base, Attribute elt)
+ : ElementsAttributeStorage(base), elt(elt) {}
Attribute elt;
};
/// An attribute representing a reference to a dense vector or tensor object.
struct DenseElementsAttributeStorage : public ElementsAttributeStorage {
+ DenseElementsAttributeStorage(ElementsAttributeStorage base,
+ ArrayRef<char> data)
+ : ElementsAttributeStorage(base), data(data) {}
ArrayRef<char> data;
};
/// An attribute representing a reference to a tensor constant with opaque
/// content.
struct OpaqueElementsAttributeStorage : public ElementsAttributeStorage {
+ OpaqueElementsAttributeStorage(ElementsAttributeStorage base,
+ Dialect *dialect, StringRef bytes)
+ : ElementsAttributeStorage(base), dialect(dialect), bytes(bytes) {}
Dialect *dialect;
StringRef bytes;
};
/// An attribute representing a reference to a sparse vector or tensor object.
struct SparseElementsAttributeStorage : public ElementsAttributeStorage {
+ SparseElementsAttributeStorage(ElementsAttributeStorage base,
+ DenseIntElementsAttr indices,
+ DenseElementsAttr values)
+ : ElementsAttributeStorage(base), indices(indices), values(values) {}
DenseIntElementsAttr indices;
DenseElementsAttr values;
};
void AllocOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
MLIRContext *context) {
- results.push_back(std::make_unique<SimplifyAllocConst>(context));
- results.push_back(std::make_unique<SimplifyDeadAlloc>(context));
+ results.push_back(llvm::make_unique<SimplifyAllocConst>(context));
+ results.push_back(llvm::make_unique<SimplifyDeadAlloc>(context));
}
//===----------------------------------------------------------------------===//
void CallIndirectOp::getCanonicalizationPatterns(
OwningRewritePatternList &results, MLIRContext *context) {
results.push_back(
- std::make_unique<SimplifyIndirectCallWithKnownCallee>(context));
+ llvm::make_unique<SimplifyIndirectCallWithKnownCallee>(context));
}
//===----------------------------------------------------------------------===//
void CondBranchOp::getCanonicalizationPatterns(
OwningRewritePatternList &results, MLIRContext *context) {
- results.push_back(std::make_unique<SimplifyConstCondBranchPred>(context));
+ results.push_back(llvm::make_unique<SimplifyConstCondBranchPred>(context));
}
Block *CondBranchOp::getTrueDest() {
MLIRContext *context) {
/// dealloc(memrefcast) -> dealloc
results.push_back(
- std::make_unique<MemRefCastFolder>(getOperationName(), context));
- results.push_back(std::make_unique<SimplifyDeadDealloc>(context));
+ llvm::make_unique<MemRefCastFolder>(getOperationName(), context));
+ results.push_back(llvm::make_unique<SimplifyDeadDealloc>(context));
}
//===----------------------------------------------------------------------===//
MLIRContext *context) {
/// dma_start(memrefcast) -> dma_start
results.push_back(
- std::make_unique<MemRefCastFolder>(getOperationName(), context));
+ llvm::make_unique<MemRefCastFolder>(getOperationName(), context));
}
// ---------------------------------------------------------------------------
MLIRContext *context) {
/// dma_wait(memrefcast) -> dma_wait
results.push_back(
- std::make_unique<MemRefCastFolder>(getOperationName(), context));
+ llvm::make_unique<MemRefCastFolder>(getOperationName(), context));
}
//===----------------------------------------------------------------------===//
MLIRContext *context) {
/// load(memrefcast) -> load
results.push_back(
- std::make_unique<MemRefCastFolder>(getOperationName(), context));
+ llvm::make_unique<MemRefCastFolder>(getOperationName(), context));
}
//===----------------------------------------------------------------------===//
MLIRContext *context) {
/// store(memrefcast) -> store
results.push_back(
- std::make_unique<MemRefCastFolder>(getOperationName(), context));
+ llvm::make_unique<MemRefCastFolder>(getOperationName(), context));
}
//===----------------------------------------------------------------------===//
void SubIOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
MLIRContext *context) {
- results.push_back(std::make_unique<SimplifyXMinusX>(context));
+ results.push_back(llvm::make_unique<SimplifyXMinusX>(context));
}
//===----------------------------------------------------------------------===//
std::deque<std::unique_ptr<CFGStackNode>> stack;
// Process the nodes of the dom tree for this region.
- stack.emplace_back(std::make_unique<CFGStackNode>(
+ stack.emplace_back(llvm::make_unique<CFGStackNode>(
knownValues, domInfo.getRootNode(®ion)));
while (!stack.empty()) {
if (currentNode->childIterator != currentNode->node->end()) {
auto *childNode = *(currentNode->childIterator++);
stack.emplace_back(
- std::make_unique<CFGStackNode>(knownValues, childNode));
+ llvm::make_unique<CFGStackNode>(knownValues, childNode));
} else {
// Finally, if the node and all of its children have been processed
// then we delete the node.
}
// Compute the MemRefRegion accessed.
- auto region = std::make_unique<MemRefRegion>(opInst->getLoc());
+ auto region = llvm::make_unique<MemRefRegion>(opInst->getLoc());
if (failed(region->compute(opInst, dmaDepth))) {
LLVM_DEBUG(llvm::dbgs()
<< "Error obtaining memory region: semi-affine maps?\n");
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <iomanip>
+#include <sstream>
#define DEBUG_TYPE "loop-fusion"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include <iomanip>
+#include <sstream>
using namespace mlir;
std::unique_ptr<DominanceInfo> domInfo;
std::unique_ptr<PostDominanceInfo> postDomInfo;
if (domInstFilter)
- domInfo = std::make_unique<DominanceInfo>(domInstFilter->getFunction());
+ domInfo = llvm::make_unique<DominanceInfo>(domInstFilter->getFunction());
if (postDomInstFilter)
postDomInfo =
- std::make_unique<PostDominanceInfo>(postDomInstFilter->getFunction());
+ llvm::make_unique<PostDominanceInfo>(postDomInstFilter->getFunction());
// The ops where memref replacement succeeds are replaced with new ones.
SmallVector<Instruction *, 8> opsToErase;
// CHECK: PatternRewriter &rewriter)
// CHECK: rewriter.create<Y::AddOp>(loc, op->getResult(0)->getType()
// CHECK: void populateWithGenerated
-// CHECK: patterns->push_back(std::make_unique<GeneratedConvert0>(context))
+// CHECK: patterns->push_back(llvm::make_unique<GeneratedConvert0>(context))
// CHECK-NEXT: rewriter.replaceOp(op, {vAddOp0});
// CHECK: void populateWithGenerated
-// CHECK: patterns->push_back(std::make_unique<GeneratedConvert0>(context))
-// CHECK: patterns->push_back(std::make_unique<GeneratedConvert1>(context))
+// CHECK: patterns->push_back(llvm::make_unique<GeneratedConvert0>(context))
+// CHECK: patterns->push_back(llvm::make_unique<GeneratedConvert1>(context))
os << R"(
PatternMatchResult match(Instruction *op0) const override {
auto ctx = op0->getContext(); (void)ctx;
- auto state = std::make_unique<MatchedState>();)"
+ auto state = llvm::make_unique<MatchedState>();)"
<< "\n";
// The rewrite pattern may specify that certain outputs should be unused in
os << "void populateWithGenerated(MLIRContext *context, "
<< "OwningRewritePatternList *patterns) {\n";
for (unsigned i = 0; i != rewritePatternCount; ++i) {
- os.indent(2) << "patterns->push_back(std::make_unique<" << baseRewriteName
+ os.indent(2) << "patterns->push_back(llvm::make_unique<" << baseRewriteName
<< i << ">(context));\n";
}
os << "}\n";