mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 00:06:06 +00:00
[mlir] Drop uses of operator<<(raw_ostream &OS, const Optional<T> &O)
This commit is contained in:
parent
5d7c5e6199
commit
bef481df8b
@ -30,7 +30,7 @@ public:
|
||||
static IntegerValueRange getMaxRange(Value value);
|
||||
|
||||
/// Create an integer value range lattice value.
|
||||
IntegerValueRange(Optional<ConstantIntRanges> value = std::nullopt)
|
||||
IntegerValueRange(std::optional<ConstantIntRanges> value = std::nullopt)
|
||||
: value(std::move(value)) {}
|
||||
|
||||
/// Whether the range is uninitialized. This happens when the state hasn't
|
||||
@ -63,7 +63,7 @@ public:
|
||||
|
||||
private:
|
||||
/// The known integer value range.
|
||||
Optional<ConstantIntRanges> value;
|
||||
std::optional<ConstantIntRanges> value;
|
||||
};
|
||||
|
||||
/// This lattice element represents the integer value range of an SSA value.
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
|
||||
/// Return the root node that this pattern matches. Patterns that can match
|
||||
/// multiple root types return std::nullopt.
|
||||
Optional<OperationName> getRootKind() const {
|
||||
std::optional<OperationName> getRootKind() const {
|
||||
if (rootKind == RootKind::OperationName)
|
||||
return OperationName::getFromOpaquePointer(rootValue);
|
||||
return std::nullopt;
|
||||
|
@ -118,7 +118,7 @@ private:
|
||||
using llvm::cl::parser<DataType>::parser;
|
||||
|
||||
/// Returns an argument name that maps to the specified value.
|
||||
Optional<StringRef> findArgStrForValue(const DataType &value) {
|
||||
std::optional<StringRef> findArgStrForValue(const DataType &value) {
|
||||
for (auto &it : this->Values)
|
||||
if (it.V.compare(value))
|
||||
return it.Name;
|
||||
@ -130,8 +130,8 @@ private:
|
||||
template <typename DataT>
|
||||
static void printValue(raw_ostream &os, GenericOptionParser<DataT> &parser,
|
||||
const DataT &value) {
|
||||
if (Optional<StringRef> argStr = parser.findArgStrForValue(value))
|
||||
os << argStr;
|
||||
if (std::optional<StringRef> argStr = parser.findArgStrForValue(value))
|
||||
os << *argStr;
|
||||
else
|
||||
llvm_unreachable("unknown data value for option");
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ static void printMemoryAccessAttribute(
|
||||
if (auto alignment = (alignmentAttrValue ? alignmentAttrValue
|
||||
: memoryOp.getAlignment())) {
|
||||
elidedAttrs.push_back(kAlignmentAttrName);
|
||||
printer << ", " << alignment;
|
||||
printer << ", " << *alignment;
|
||||
}
|
||||
}
|
||||
printer << "]";
|
||||
@ -360,7 +360,7 @@ static void printSourceMemoryAccessAttribute(
|
||||
if (auto alignment = (alignmentAttrValue ? alignmentAttrValue
|
||||
: memoryOp.getAlignment())) {
|
||||
elidedAttrs.push_back(kSourceAlignmentAttrName);
|
||||
printer << ", " << alignment;
|
||||
printer << ", " << *alignment;
|
||||
}
|
||||
}
|
||||
printer << "]";
|
||||
|
@ -100,7 +100,7 @@ FrozenRewritePatternSet::FrozenRewritePatternSet(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Optional<OperationName> rootName = pat->getRootKind()) {
|
||||
if (std::optional<OperationName> rootName = pat->getRootKind()) {
|
||||
impl->nativeOpSpecificPatternMap[*rootName].push_back(pat.get());
|
||||
impl->nativeOpSpecificPatternList.push_back(std::move(pat));
|
||||
continue;
|
||||
|
@ -553,7 +553,7 @@ PDLDocument::buildHoverForCoreConstraint(const ast::CoreConstraintDecl *decl,
|
||||
.Case([&](const ast::OpConstraintDecl *opCst) {
|
||||
hoverOS << "Op";
|
||||
if (Optional<StringRef> name = opCst->getName())
|
||||
hoverOS << "<" << name << ">";
|
||||
hoverOS << "<" << *name << ">";
|
||||
})
|
||||
.Case([&](const ast::TypeConstraintDecl *) { hoverOS << "Type"; })
|
||||
.Case([&](const ast::TypeRangeConstraintDecl *) {
|
||||
|
@ -382,8 +382,8 @@ static std::string getNodeName(CallOpInterface op) {
|
||||
/// Return true if the specified `inlineHistoryID` indicates an inline history
|
||||
/// that already includes `node`.
|
||||
static bool inlineHistoryIncludes(
|
||||
CallGraphNode *node, Optional<size_t> inlineHistoryID,
|
||||
MutableArrayRef<std::pair<CallGraphNode *, Optional<size_t>>>
|
||||
CallGraphNode *node, std::optional<size_t> inlineHistoryID,
|
||||
MutableArrayRef<std::pair<CallGraphNode *, std::optional<size_t>>>
|
||||
inlineHistory) {
|
||||
while (inlineHistoryID.has_value()) {
|
||||
assert(inlineHistoryID.value() < inlineHistory.size() &&
|
||||
@ -488,7 +488,7 @@ static LogicalResult inlineCallsInSCC(Inliner &inliner, CGUseList &useList,
|
||||
// When inlining a callee produces new call sites, we want to keep track of
|
||||
// the fact that they were inlined from the callee. This allows us to avoid
|
||||
// infinite inlining.
|
||||
using InlineHistoryT = Optional<size_t>;
|
||||
using InlineHistoryT = std::optional<size_t>;
|
||||
SmallVector<std::pair<CallGraphNode *, InlineHistoryT>, 8> inlineHistory;
|
||||
std::vector<InlineHistoryT> callHistory(calls.size(), InlineHistoryT{});
|
||||
|
||||
|
@ -2146,7 +2146,7 @@ void OperationLegalizer::buildLegalizationGraph(
|
||||
|
||||
// Build the mapping from operations to the parent ops that may generate them.
|
||||
applicator.walkAllPatterns([&](const Pattern &pattern) {
|
||||
Optional<OperationName> root = pattern.getRootKind();
|
||||
std::optional<OperationName> root = pattern.getRootKind();
|
||||
|
||||
// If the pattern has no specific root, we can't analyze the relationship
|
||||
// between the root op and generated operations. Given that, add all such
|
||||
@ -2228,7 +2228,7 @@ void OperationLegalizer::computeLegalizationGraphBenefit(
|
||||
// decreasing benefit.
|
||||
applicator.applyCostModel([&](const Pattern &pattern) {
|
||||
ArrayRef<const Pattern *> orderedPatternList;
|
||||
if (Optional<OperationName> rootName = pattern.getRootKind())
|
||||
if (std::optional<OperationName> rootName = pattern.getRootKind())
|
||||
orderedPatternList = legalizerPatterns[*rootName];
|
||||
else
|
||||
orderedPatternList = anyOpLegalizerPatterns;
|
||||
|
@ -21,7 +21,7 @@ namespace {
|
||||
class UnderlyingValue {
|
||||
public:
|
||||
/// Create an underlying value state with a known underlying value.
|
||||
explicit UnderlyingValue(Optional<Value> underlyingValue = std::nullopt)
|
||||
explicit UnderlyingValue(std::optional<Value> underlyingValue = std::nullopt)
|
||||
: underlyingValue(underlyingValue) {}
|
||||
|
||||
/// Whether the state is uninitialized.
|
||||
@ -54,7 +54,7 @@ public:
|
||||
void print(raw_ostream &os) const { os << underlyingValue; }
|
||||
|
||||
private:
|
||||
Optional<Value> underlyingValue;
|
||||
std::optional<Value> underlyingValue;
|
||||
};
|
||||
|
||||
/// This lattice represents, for a given memory resource, the potential last
|
||||
|
@ -1145,7 +1145,7 @@ if ({1}Iter != attrs.end()) {{
|
||||
Optional<std::string> cppValue = generateExpression(assignment->value);
|
||||
if (!cppValue)
|
||||
return failure();
|
||||
stmts.push_back(llvm::formatv("yields.push_back({0});", cppValue));
|
||||
stmts.push_back(llvm::formatv("yields.push_back({0});", *cppValue));
|
||||
}
|
||||
|
||||
if (generatedAssignmentCount != assignments.size())
|
||||
|
Loading…
x
Reference in New Issue
Block a user