}
void
setRetainCountConvention(llvm::Optional<RetainCountConventionKind> Value) {
- RawRetainCountConvention =
- Value.hasValue() ? static_cast<unsigned>(Value.getValue()) + 1 : 0;
+ RawRetainCountConvention = Value ? static_cast<unsigned>(*Value) + 1 : 0;
assert(getRetainCountConvention() == Value && "bitfield too small");
}
}
void
setRetainCountConvention(llvm::Optional<RetainCountConventionKind> Value) {
- RawRetainCountConvention =
- Value.hasValue() ? static_cast<unsigned>(Value.getValue()) + 1 : 0;
+ RawRetainCountConvention = Value ? static_cast<unsigned>(*Value) + 1 : 0;
assert(getRetainCountConvention() == Value && "bitfield too small");
}
auto Mapping = VersionMappings.find(Kind.Value);
if (Mapping == VersionMappings.end())
return nullptr;
- return Mapping->getSecond().hasValue() ? Mapping->getSecond().getPointer()
- : nullptr;
+ return Mapping->getSecond() ? Mapping->getSecond().getPointer() : nullptr;
}
static Optional<DarwinSDKInfo>
Optional<bool> isPublic;
for (; MD; MD = MD->getPrevious()) {
if (DefMacroDirective *DefMD = dyn_cast<DefMacroDirective>(MD))
- return DefInfo(DefMD, UndefLoc,
- !isPublic.hasValue() || isPublic.getValue());
+ return DefInfo(DefMD, UndefLoc, !isPublic || *isPublic);
if (UndefMacroDirective *UndefMD = dyn_cast<UndefMacroDirective>(MD)) {
UndefLoc = UndefMD->getLocation();
if (!buffer.empty())
line = buffer;
}));
- if (future->wait_for(timeout) == std::future_status::timeout ||
- !line.hasValue())
+ if (future->wait_for(timeout) == std::future_status::timeout || !line)
return createStringError(inconvertibleErrorCode(),
"Timed out trying to get messages from the " +
m_other_endpoint_name);
/// debug info, we might end up with multiple FunctionInfo objects for the
/// same range and we need to be able to tell which one is the better object
/// to use.
- bool hasRichInfo() const {
- return OptLineTable.hasValue() || Inline.hasValue();
- }
+ bool hasRichInfo() const { return OptLineTable || Inline; }
/// Query if a FunctionInfo object is valid.
///
void printYAML(raw_ostream &OS) const {
OS << " -\n"
<< " Function: " << Function << "\n"
- << " SymbolName: "
- << (SymbolName.hasValue() ? SymbolName.getValue() : "<None>") << "\n"
+ << " SymbolName: " << SymbolName.value_or("<None>") << "\n"
<< " LineOffset: " << LineOffset << "\n"
<< " Column: " << Column << "\n"
<< " Inline: " << IsInlineFrame << "\n";
const DataLayout &DL, unsigned Reg, Type *Ty,
Optional<CallingConv::ID> CC);
- bool isABIMangled() const {
- return CallConv.hasValue();
- }
+ bool isABIMangled() const { return CallConv.has_value(); }
/// Add the specified values to this one.
void append(const RegsForValue &RHS) {
// obj2yaml does not dump these fields. They can be used to override nchain
// and nbucket values for creating broken sections.
- assert(!IO.outputting() ||
- (!Section.NBucket.hasValue() && !Section.NChain.hasValue()));
+ assert(!IO.outputting() || (!Section.NBucket && !Section.NChain));
IO.mapOptional("NChain", Section.NChain);
IO.mapOptional("NBucket", Section.NBucket);
}
getNumRegisters(LLVMContext &Context, EVT VT,
Optional<MVT> RegisterVT) const override {
// i128 inline assembly operand.
- if (VT == MVT::i128 &&
- RegisterVT.hasValue() && RegisterVT.getValue() == MVT::Untyped)
+ if (VT == MVT::i128 && RegisterVT && *RegisterVT == MVT::Untyped)
return 1;
return TargetLowering::getNumRegisters(Context, VT);
}
MSSAU = MemorySSAUpdater(AR.MSSA);
bool DeleteCurrentLoop = false;
if (!simplifyLoopCFG(L, AR.DT, AR.LI, AR.SE,
- MSSAU.hasValue() ? MSSAU.getPointer() : nullptr,
- DeleteCurrentLoop))
+ MSSAU ? MSSAU.getPointer() : nullptr, DeleteCurrentLoop))
return PreservedAnalyses::all();
if (DeleteCurrentLoop)
AR.MSSA->verifyMemorySSA();
}
if (!unswitchLoop(L, AR.DT, AR.LI, AR.AC, AR.AA, AR.TTI, Trivial, NonTrivial,
- UnswitchCB, &AR.SE,
- MSSAU.hasValue() ? MSSAU.getPointer() : nullptr,
+ UnswitchCB, &AR.SE, MSSAU ? MSSAU.getPointer() : nullptr,
DestroyLoopCB))
return PreservedAnalyses::all();
StringRef FilePath2) {
auto Status1 = getFileStatus(FilePath1);
auto Status2 = getFileStatus(FilePath2);
- return Status1.hasValue() && Status2.hasValue() &&
- sys::fs::equivalent(Status1.getValue(), Status2.getValue());
+ return Status1 && Status2 && sys::fs::equivalent(*Status1, *Status2);
}
ErrorOr<const MemoryBuffer &>
template <typename OptionalT>
struct stringifier<Optional<OptionalT>> {
static std::string apply(Optional<OptionalT> optional) {
- return optional.hasValue() ? stringifier<OptionalT>::apply(*optional)
- : std::string();
+ return optional ? stringifier<OptionalT>::apply(*optional) : std::string();
}
};
} // namespace detail
return dirs;
}
-bool IntegerRelation::isIntegerEmpty() const {
- return !findIntegerSample().hasValue();
-}
+bool IntegerRelation::isIntegerEmpty() const { return !findIntegerSample(); }
/// Let this set be S. If S is bounded then we directly call into the GBR
/// sampling algorithm. Otherwise, there are some unbounded directions, i.e.,
unsigned stride = type.getArrayStride();
Type elementType = type.getElementType();
auto sizeInBytes = elementType.cast<spirv::SPIRVType>().getSizeInBytes();
- if (stride != 0 &&
- !(sizeInBytes.hasValue() && sizeInBytes.getValue() == stride))
+ if (stride != 0 && !(sizeInBytes && *sizeInBytes == stride))
return llvm::None;
auto llvmElementType = converter.convertType(elementType);
// 3. Is being inserted at the innermost insertion point.
Optional<bool> isMaximal = sliceState->isMaximal();
if (isLoopParallelAndContainsReduction(getSliceLoop(i)) &&
- isInnermostInsertion() && srcIsUnitSlice() && isMaximal.hasValue() &&
- isMaximal.getValue())
+ isInnermostInsertion() && srcIsUnitSlice() && isMaximal && *isMaximal)
continue;
for (unsigned j = i; j < numSliceLoopIVs; ++j) {
sliceState->lbs[j] = AffineMap();
msg << " fusion is most profitable at depth " << *dstLoopDepth << " with "
<< std::setprecision(2) << additionalComputeFraction
<< "% redundant computation and a ";
- msg << (storageReduction.hasValue()
- ? std::to_string(storageReduction.getValue())
- : "<unknown>");
+ msg << (storageReduction ? std::to_string(*storageReduction) : "<unknown>");
msg << "% storage reduction.\n";
llvm::dbgs() << msg.str();
});
// If the trip count is lower than the unroll factor, no unrolled body.
// TODO: option to specify cleanup loop unrolling.
- if (mayBeConstantTripCount.hasValue() &&
- mayBeConstantTripCount.getValue() < unrollFactor)
+ if (mayBeConstantTripCount && *mayBeConstantTripCount < unrollFactor)
return failure();
// Generate the cleanup loop if trip count isn't a multiple of unrollFactor.
return success();
// If the trip count is lower than the unroll jam factor, no unroll jam.
- if (mayBeConstantTripCount.hasValue() &&
- mayBeConstantTripCount.getValue() < unrollJamFactor) {
+ if (mayBeConstantTripCount && *mayBeConstantTripCount < unrollJamFactor) {
LLVM_DEBUG(llvm::dbgs() << "[failed] trip count < unroll-jam factor\n");
return failure();
}