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
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.
/// 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;
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;
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");
}
if (auto alignment = (alignmentAttrValue ? alignmentAttrValue
: memoryOp.getAlignment())) {
elidedAttrs.push_back(kAlignmentAttrName);
- printer << ", " << alignment;
+ printer << ", " << *alignment;
}
}
printer << "]";
if (auto alignment = (alignmentAttrValue ? alignmentAttrValue
: memoryOp.getAlignment())) {
elidedAttrs.push_back(kSourceAlignmentAttrName);
- printer << ", " << alignment;
+ printer << ", " << *alignment;
}
}
printer << "]";
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;
.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 *) {
/// 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() &&
// 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{});
// 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
// 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;
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.
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
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())