continue;
}
LLVM_DEBUG(dbgs() << getBlockName(HeaderNode)
- << " has irr loop header weight "
- << HeaderWeight.value() << "\n");
+ << " has irr loop header weight " << *HeaderWeight
+ << "\n");
NumHeadersWithWeight++;
- uint64_t HeaderWeightValue = HeaderWeight.value();
+ uint64_t HeaderWeightValue = *HeaderWeight;
if (!MinHeaderWeight || HeaderWeightValue < MinHeaderWeight)
MinHeaderWeight = HeaderWeightValue;
if (HeaderWeightValue) {
if (std::optional<uint64_t> ProfileCount =
BlockFrequencyInfoImplBase::getBlockProfileCount(
F->getFunction(), getNode(&BB)))
- OS << ", count = " << ProfileCount.value();
+ OS << ", count = " << *ProfileCount;
if (std::optional<uint64_t> IrrLoopHeaderWeight =
BB.getIrrLoopHeaderWeight())
- OS << ", irr_loop_header_weight = " << IrrLoopHeaderWeight.value();
+ OS << ", irr_loop_header_weight = " << *IrrLoopHeaderWeight;
OS << "\n";
}
// ensuring that the variant described in the attribute has a
// corresponding definition or declaration of the vector
// function in the Module M.
- if (Shape && (Shape.value().ScalarName == ScalarName)) {
- assert(CI.getModule()->getFunction(Shape.value().VectorName) &&
+ if (Shape && (Shape->ScalarName == ScalarName)) {
+ assert(CI.getModule()->getFunction(Shape->VectorName) &&
"Vector function is missing.");
- Mappings.push_back(Shape.value());
+ Mappings.push_back(*Shape);
}
}
}
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i++);
if (Op.isLiteral())
- EmitAbbreviatedLiteral(Op, Code.value());
+ EmitAbbreviatedLiteral(Op, *Code);
else {
assert(Op.getEncoding() != BitCodeAbbrevOp::Array &&
Op.getEncoding() != BitCodeAbbrevOp::Blob &&
"Expected literal or scalar");
- EmitAbbreviatedField(Op, Code.value());
+ EmitAbbreviatedField(Op, *Code);
}
}
RoundingMode UseRounding = DefaultConstrainedRounding;
if (Rounding)
- UseRounding = Rounding.value();
+ UseRounding = *Rounding;
std::optional<StringRef> RoundingStr =
convertRoundingModeToStr(UseRounding);
assert(RoundingStr && "Garbage strict rounding mode!");
- auto *RoundingMDS = MDString::get(Context, RoundingStr.value());
+ auto *RoundingMDS = MDString::get(Context, *RoundingStr);
return MetadataAsValue::get(Context, RoundingMDS);
}
Value *getConstrainedFPExcept(std::optional<fp::ExceptionBehavior> Except) {
- fp::ExceptionBehavior UseExcept = DefaultConstrainedExcept;
-
- if (Except)
- UseExcept = Except.value();
-
- std::optional<StringRef> ExceptStr =
- convertExceptionBehaviorToStr(UseExcept);
+ std::optional<StringRef> ExceptStr = convertExceptionBehaviorToStr(
+ Except.value_or(DefaultConstrainedExcept));
assert(ExceptStr && "Garbage strict exception behavior!");
- auto *ExceptMDS = MDString::get(Context, ExceptStr.value());
+ auto *ExceptMDS = MDString::get(Context, *ExceptStr);
return MetadataAsValue::get(Context, ExceptMDS);
}
bool hasImportModule() const { return ImportModule.has_value(); }
StringRef getImportModule() const {
if (ImportModule)
- return ImportModule.value();
+ return *ImportModule;
// Use a default module name of "env" for now, for compatibility with
// existing tools.
// TODO(sbc): Find a way to specify a default value in the object format
bool hasImportName() const { return ImportName.has_value(); }
StringRef getImportName() const {
if (ImportName)
- return ImportName.value();
+ return *ImportName;
return getName();
}
void setImportName(StringRef Name) { ImportName = Name; }
bool hasExportName() const { return ExportName.has_value(); }
- StringRef getExportName() const { return ExportName.value(); }
+ StringRef getExportName() const { return *ExportName; }
void setExportName(StringRef Name) { ExportName = Name; }
bool isFunctionTable() const {
const wasm::WasmGlobalType &getGlobalType() const {
assert(GlobalType);
- return GlobalType.value();
+ return *GlobalType;
}
void setGlobalType(wasm::WasmGlobalType GT) { GlobalType = GT; }
bool hasTableType() const { return TableType.has_value(); }
const wasm::WasmTableType &getTableType() const {
assert(hasTableType());
- return TableType.value();
+ return *TableType;
}
void setTableType(wasm::WasmTableType TT) { TableType = TT; }
void setTableType(wasm::ValType VT) {
XCOFF::StorageClass getStorageClass() const {
assert(StorageClass && "StorageClass not set on XCOFF MCSymbol.");
- return StorageClass.value();
+ return *StorageClass;
}
StringRef getUnqualifiedName() const { return getUnqualifiedName(getName()); }
static inline bool isPresent(const std::optional<T> &t) {
return t.has_value();
}
- static inline decltype(auto) unwrapValue(std::optional<T> &t) {
- return t.value();
- }
+ static inline decltype(auto) unwrapValue(std::optional<T> &t) { return *t; }
};
// If something is "nullable" then we just compare it to nullptr to see if it
if (auto BBWeight = getInitialEstimatedBlockWeight(BB))
// If we were able to find estimated weight for the block set it to this
// block and propagate up the IR.
- propagateEstimatedBlockWeight(getLoopBlock(BB), DT, PDT, BBWeight.value(),
+ propagateEstimatedBlockWeight(getLoopBlock(BB), DT, PDT, *BBWeight,
BlockWorkList, LoopWorkList);
// BlockWorklist/LoopWorkList contains blocks/loops with at least one
"Can only get a predicate from a compare instruction");
if (RevisedPredicate)
- return RevisedPredicate.value();
+ return *RevisedPredicate;
return cast<CmpInst>(Inst)->getPredicate();
}
BlockFrequencyInfo *BFI = &(GetBFI(F));
assert(BFI && "BFI must be available");
auto ProfileCount = BFI->getBlockProfileCount(BB);
- assert(ProfileCount);
- if (ProfileCount.value() == 0)
+ if (*ProfileCount == 0)
ColdSize += Cost - CostAtBBStart;
}
}
auto ProfileCount = CalleeBFI->getBlockProfileCount(&BB);
- assert(ProfileCount);
- CurrentSavings *= ProfileCount.value();
+ CurrentSavings *= *ProfileCount;
CycleSavings += CurrentSavings;
}
// return min(A, B) if B is valid.
auto MinIfValid = [](int A, std::optional<int> B) {
- return B ? std::min(A, B.value()) : A;
+ return B ? std::min(A, *B) : A;
};
// return max(A, B) if B is valid.
auto MaxIfValid = [](int A, std::optional<int> B) {
- return B ? std::max(A, B.value()) : A;
+ return B ? std::max(A, *B) : A;
};
// Various bonus percentages. These are multiplied by Threshold to get the
}
if (std::optional<bool> Implied = isImpliedCondition(Op1, Op0, Q.DL)) {
// If Op1 is true implies Op0 is true, then Op1 is a subset of Op0.
- if (Implied.value())
+ if (*Implied)
return Op1;
// If Op1 is true implies Op0 is false, then they are not true together.
- if (!Implied.value())
+ if (!*Implied)
return ConstantInt::getFalse(Op1->getType());
}
}
Value *Op1 = Call->getArgOperand(1);
Value *Op2 = Call->getArgOperand(2);
auto *FPI = cast<ConstrainedFPIntrinsic>(Call);
- if (Value *V = simplifyFPOp({Op0, Op1, Op2}, {}, Q,
- FPI->getExceptionBehavior().value(),
- FPI->getRoundingMode().value()))
+ if (Value *V =
+ simplifyFPOp({Op0, Op1, Op2}, {}, Q, *FPI->getExceptionBehavior(),
+ *FPI->getRoundingMode()))
return V;
return nullptr;
}
auto *FPI = cast<ConstrainedFPIntrinsic>(Call);
return simplifyFAddInst(
FPI->getArgOperand(0), FPI->getArgOperand(1), FPI->getFastMathFlags(),
- Q, FPI->getExceptionBehavior().value(), FPI->getRoundingMode().value());
+ Q, *FPI->getExceptionBehavior(), *FPI->getRoundingMode());
}
case Intrinsic::experimental_constrained_fsub: {
auto *FPI = cast<ConstrainedFPIntrinsic>(Call);
return simplifyFSubInst(
FPI->getArgOperand(0), FPI->getArgOperand(1), FPI->getFastMathFlags(),
- Q, FPI->getExceptionBehavior().value(), FPI->getRoundingMode().value());
+ Q, *FPI->getExceptionBehavior(), *FPI->getRoundingMode());
}
case Intrinsic::experimental_constrained_fmul: {
auto *FPI = cast<ConstrainedFPIntrinsic>(Call);
return simplifyFMulInst(
FPI->getArgOperand(0), FPI->getArgOperand(1), FPI->getFastMathFlags(),
- Q, FPI->getExceptionBehavior().value(), FPI->getRoundingMode().value());
+ Q, *FPI->getExceptionBehavior(), *FPI->getRoundingMode());
}
case Intrinsic::experimental_constrained_fdiv: {
auto *FPI = cast<ConstrainedFPIntrinsic>(Call);
return simplifyFDivInst(
FPI->getArgOperand(0), FPI->getArgOperand(1), FPI->getFastMathFlags(),
- Q, FPI->getExceptionBehavior().value(), FPI->getRoundingMode().value());
+ Q, *FPI->getExceptionBehavior(), *FPI->getRoundingMode());
}
case Intrinsic::experimental_constrained_frem: {
auto *FPI = cast<ConstrainedFPIntrinsic>(Call);
return simplifyFRemInst(
FPI->getArgOperand(0), FPI->getArgOperand(1), FPI->getFastMathFlags(),
- Q, FPI->getExceptionBehavior().value(), FPI->getRoundingMode().value());
+ Q, *FPI->getExceptionBehavior(), *FPI->getRoundingMode());
}
default:
return nullptr;
if (!LHSRes)
// More work to do before applying this transfer rule.
return std::nullopt;
- const ConstantRange &LHSRange = LHSRes.value();
+ const ConstantRange &LHSRange = *LHSRes;
const unsigned ResultBitWidth = CI->getType()->getIntegerBitWidth();
// More work to do before applying this transfer rule.
return std::nullopt;
- const ConstantRange &LHSRange = LHSRes.value();
- const ConstantRange &RHSRange = RHSRes.value();
+ const ConstantRange &LHSRange = *LHSRes;
+ const ConstantRange &RHSRange = *RHSRes;
return ValueLatticeElement::getRange(OpFn(LHSRange, RHSRange));
}
// Callee is some known library function.
const auto AllocData = getAllocationDataForFunction(Callee, AnyAlloc, TLI);
if (AllocData)
- return mangledNameForMallocFamily(AllocData.value().Family);
+ return mangledNameForMallocFamily(AllocData->Family);
const auto FreeData = getFreeFunctionDataForFunction(Callee, TLIFn);
if (FreeData)
- return mangledNameForMallocFamily(FreeData.value().Family);
+ return mangledNameForMallocFamily(FreeData->Family);
}
// Callee isn't a known library function, still check attributes.
if (checkFnAllocKind(I, AllocFnKind::Free | AllocFnKind::Alloc |
std::optional<V> &OptVal = Map[Key];
if (!OptVal)
OptVal = Fn(std::forward<ArgsTy>(args)...);
- return OptVal.value();
+ return *OptVal;
}
const BasicBlock *
}
bool ProfileSummaryInfo::hasHugeWorkingSetSize() const {
- return HasHugeWorkingSetSize && HasHugeWorkingSetSize.value();
+ return HasHugeWorkingSetSize && *HasHugeWorkingSetSize;
}
bool ProfileSummaryInfo::hasLargeWorkingSetSize() const {
- return HasLargeWorkingSetSize && HasLargeWorkingSetSize.value();
+ return HasLargeWorkingSetSize && *HasLargeWorkingSetSize;
}
bool ProfileSummaryInfo::isHotCount(uint64_t C) const {
- return HotCountThreshold && C >= HotCountThreshold.value();
+ return HotCountThreshold && C >= *HotCountThreshold;
}
bool ProfileSummaryInfo::isColdCount(uint64_t C) const {
- return ColdCountThreshold && C <= ColdCountThreshold.value();
+ return ColdCountThreshold && C <= *ColdCountThreshold;
}
template <bool isHot>
uint64_t C) const {
auto CountThreshold = computeThreshold(PercentileCutoff);
if (isHot)
- return CountThreshold && C >= CountThreshold.value();
+ return CountThreshold && C >= *CountThreshold;
else
- return CountThreshold && C <= CountThreshold.value();
+ return CountThreshold && C <= *CountThreshold;
}
bool ProfileSummaryInfo::isHotCountNthPercentile(int PercentileCutoff,
std::optional<const SCEV *> Res =
compareWithBackedgeCondition(SI->getCondition());
if (Res) {
- bool IsOne = cast<SCEVConstant>(Res.value())->getValue()->isOne();
+ bool IsOne = cast<SCEVConstant>(*Res)->getValue()->isOne();
Result = SE.getSCEV(IsOne ? SI->getTrueValue() : SI->getFalseValue());
}
break;
default: {
std::optional<const SCEV *> Res = compareWithBackedgeCondition(I);
if (Res)
- Result = Res.value();
+ Result = *Res;
break;
}
}
std::optional<ConstantRange> MDRange = GetRangeFromMetadata(U->getValue());
if (MDRange)
ConservativeResult =
- ConservativeResult.intersectWith(MDRange.value(), RangeType);
+ ConservativeResult.intersectWith(*MDRange, RangeType);
// Use facts about recurrences in the underlying IR. Note that add
// recurrences are AddRecExprs and thus don't hit this path. This
auto ResultSwapped =
getMonotonicPredicateTypeImpl(LHS, ICmpInst::getSwappedPredicate(Pred));
- assert(ResultSwapped && "should be able to analyze both!");
- assert(ResultSwapped.value() != Result.value() &&
+ assert(*ResultSwapped != *Result &&
"monotonicity should flip as we flip the predicate");
}
#endif
std::optional<VFInfo> Info =
VFABI::tryDemangleForVFABI(S, *(CI.getModule()));
assert(Info && "Invalid name for a VFABI variant.");
- assert(CI.getModule()->getFunction(Info.value().VectorName) &&
+ assert(CI.getModule()->getFunction(Info->VectorName) &&
"Vector function is missing.");
#endif
VariantMappings.push_back(std::string(S));
if (auto DeclFileAttr = Die.find(DW_AT_decl_file)) {
if (const auto *LT = CU->getContext().getLineTableForUnit(CU))
LT->getFileNameByIndex(
- DeclFileAttr->getAsUnsignedConstant().value(),
- CU->getCompilationDir(),
+ *DeclFileAttr->getAsUnsignedConstant(), CU->getCompilationDir(),
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
Local.DeclFile);
}
if (auto DeclLineAttr = Die.find(DW_AT_decl_line))
- Local.DeclLine = DeclLineAttr->getAsUnsignedConstant().value();
+ Local.DeclLine = *DeclLineAttr->getAsUnsignedConstant();
Result.push_back(Local);
return;
FileEntry.Source = Value;
break;
case DW_LNCT_directory_index:
- FileEntry.DirIdx = Value.getAsUnsignedConstant().value();
+ FileEntry.DirIdx = *Value.getAsUnsignedConstant();
break;
case DW_LNCT_timestamp:
- FileEntry.ModTime = Value.getAsUnsignedConstant().value();
+ FileEntry.ModTime = *Value.getAsUnsignedConstant();
break;
case DW_LNCT_size:
- FileEntry.Length = Value.getAsUnsignedConstant().value();
+ FileEntry.Length = *Value.getAsUnsignedConstant();
break;
case DW_LNCT_MD5:
- if (!Value.getAsBlock() || Value.getAsBlock().value().size() != 16)
+ if (!Value.getAsBlock() || Value.getAsBlock()->size() != 16)
return createStringError(
errc::invalid_argument,
"failed to parse file entry because the MD5 hash is invalid");
- std::uninitialized_copy_n(Value.getAsBlock().value().begin(), 16,
+ std::uninitialized_copy_n(Value.getAsBlock()->begin(), 16,
FileEntry.Checksum.begin());
break;
default:
auto R = DIExpression::createFragmentExpression(Expr, Info.OffsetInBits,
Info.SizeInBits);
assert(R.has_value() && "failed to create fragment expression");
- Expr = R.value();
+ Expr = *R;
}
DIExpression *AddrExpr =
DIExpression::get(StoreLikeInst.getContext(), std::nullopt);
assert(SI.getNumSuccessors() == Weights->size() &&
"num of prof branch_weights must accord with num of successors");
- bool AllZeroes = all_of(Weights.value(), [](uint32_t W) { return W == 0; });
+ bool AllZeroes = all_of(*Weights, [](uint32_t W) { return W == 0; });
- if (AllZeroes || Weights.value().size() < 2)
+ if (AllZeroes || Weights->size() < 2)
return nullptr;
return MDBuilder(SI.getParent()->getContext()).createBranchWeights(*Weights);
// Copy the last case to the place of the removed one and shrink.
// This is tightly coupled with the way SwitchInst::removeCase() removes
// the cases in SwitchInst::removeCase(CaseIt).
- Weights.value()[I->getCaseIndex() + 1] = Weights.value().back();
- Weights.value().pop_back();
+ (*Weights)[I->getCaseIndex() + 1] = Weights->back();
+ Weights->pop_back();
}
return SI.removeCase(I);
}
if (!Weights && W && *W) {
Changed = true;
Weights = SmallVector<uint32_t, 8>(SI.getNumSuccessors(), 0);
- Weights.value()[SI.getNumSuccessors() - 1] = *W;
+ (*Weights)[SI.getNumSuccessors() - 1] = *W;
} else if (Weights) {
Changed = true;
- Weights.value().push_back(W.value_or(0));
+ Weights->push_back(W.value_or(0));
}
if (Weights)
assert(SI.getNumSuccessors() == Weights->size() &&
bool ConstrainedFPIntrinsic::isDefaultFPEnvironment() const {
std::optional<fp::ExceptionBehavior> Except = getExceptionBehavior();
if (Except) {
- if (Except.value() != fp::ebIgnore)
+ if (*Except != fp::ebIgnore)
return false;
}
std::optional<RoundingMode> Rounding = getRoundingMode();
if (Rounding) {
- if (Rounding.value() != RoundingMode::NearestTiesToEven)
+ if (*Rounding != RoundingMode::NearestTiesToEven)
return false;
}
std::optional<unsigned> PtrParamOpt =
getMemoryPointerParamPos(getIntrinsicID());
assert(PtrParamOpt && "no pointer argument!");
- return getParamAlign(PtrParamOpt.value());
+ return getParamAlign(*PtrParamOpt);
}
/// \return The pointer operand of this load,store, gather or scatter.
Value *VPIntrinsic::getMemoryPointerParam() const {
if (auto PtrParamOpt = getMemoryPointerParamPos(getIntrinsicID()))
- return getArgOperand(PtrParamOpt.value());
+ return getArgOperand(*PtrParamOpt);
return nullptr;
}
auto DataParamOpt = getMemoryDataParamPos(getIntrinsicID());
if (!DataParamOpt)
return nullptr;
- return getArgOperand(DataParamOpt.value());
+ return getArgOperand(*DataParamOpt);
}
std::optional<unsigned> VPIntrinsic::getMemoryDataParamPos(Intrinsic::ID VPID) {
}
void LLVMContextImpl::setOpaquePointers(bool OP) {
- assert((!OpaquePointers || OpaquePointers.value() == OP) &&
+ assert((!OpaquePointers || *OpaquePointers == OP) &&
"Cannot change opaque pointers mode once set");
OpaquePointers = OP;
}
std::unique_ptr<IFSStubTriple> CopyStub(new IFSStubTriple(Stub));
if (Stub.Target.Arch) {
CopyStub->Target.ArchString =
- std::string(ELF::convertEMachineToArchName(Stub.Target.Arch.value()));
+ std::string(ELF::convertEMachineToArchName(*Stub.Target.Arch));
}
IFSTarget Target = Stub.Target;
std::optional<std::string> OverrideTriple) {
std::error_code OverrideEC(1, std::generic_category());
if (OverrideArch) {
- if (Stub.Target.Arch && Stub.Target.Arch.value() != OverrideArch.value()) {
+ if (Stub.Target.Arch && *Stub.Target.Arch != OverrideArch.value()) {
return make_error<StringError>(
"Supplied Arch conflicts with the text stub", OverrideEC);
}
- Stub.Target.Arch = OverrideArch.value();
+ Stub.Target.Arch = *OverrideArch;
}
if (OverrideEndianness) {
if (Stub.Target.Endianness &&
- Stub.Target.Endianness.value() != OverrideEndianness.value()) {
+ *Stub.Target.Endianness != OverrideEndianness.value()) {
return make_error<StringError>(
"Supplied Endianness conflicts with the text stub", OverrideEC);
}
- Stub.Target.Endianness = OverrideEndianness.value();
+ Stub.Target.Endianness = *OverrideEndianness;
}
if (OverrideBitWidth) {
if (Stub.Target.BitWidth &&
- Stub.Target.BitWidth.value() != OverrideBitWidth.value()) {
+ *Stub.Target.BitWidth != OverrideBitWidth.value()) {
return make_error<StringError>(
"Supplied BitWidth conflicts with the text stub", OverrideEC);
}
- Stub.Target.BitWidth = OverrideBitWidth.value();
+ Stub.Target.BitWidth = *OverrideBitWidth;
}
if (OverrideTriple) {
- if (Stub.Target.Triple &&
- Stub.Target.Triple.value() != OverrideTriple.value()) {
+ if (Stub.Target.Triple && *Stub.Target.Triple != OverrideTriple.value()) {
return make_error<StringError>(
"Supplied Triple conflicts with the text stub", OverrideEC);
}
- Stub.Target.Triple = OverrideTriple.value();
+ Stub.Target.Triple = *OverrideTriple;
}
return Error::success();
}
if (Value.has_value() || MaxBytesToEmit) {
if (Value.has_value()) {
OS << ", 0x";
- OS.write_hex(truncateToSize(Value.value(), ValueSize));
+ OS.write_hex(truncateToSize(*Value, ValueSize));
} else {
OS << ", ";
}
OS << ' ' << ByteAlignment;
if (Value.has_value())
- OS << ", " << truncateToSize(Value.value(), ValueSize);
+ OS << ", " << truncateToSize(*Value, ValueSize);
else if (MaxBytesToEmit)
OS << ", ";
if (MaxBytesToEmit)
// Do the lookup. If we have a hit, return it.
auto IterBool = XCOFFUniquingMap.insert(std::make_pair(
- IsDwarfSec
- ? XCOFFSectionKey(Section.str(), DwarfSectionSubtypeFlags.value())
- : XCOFFSectionKey(Section.str(), CsectProp->MappingClass),
+ IsDwarfSec ? XCOFFSectionKey(Section.str(), *DwarfSectionSubtypeFlags)
+ : XCOFFSectionKey(Section.str(), CsectProp->MappingClass),
nullptr));
auto &Entry = *IterBool.first;
if (!IterBool.second) {
// CachedName contains invalid character(s) such as '$' for an XCOFF symbol.
MCSectionXCOFF *Result = nullptr;
if (IsDwarfSec)
- Result = new (XCOFFAllocator.Allocate())
- MCSectionXCOFF(QualName->getUnqualifiedName(), Kind, QualName,
- DwarfSectionSubtypeFlags.value(), Begin, CachedName,
- MultiSymbolsAllowed);
+ Result = new (XCOFFAllocator.Allocate()) MCSectionXCOFF(
+ QualName->getUnqualifiedName(), Kind, QualName,
+ *DwarfSectionSubtypeFlags, Begin, CachedName, MultiSymbolsAllowed);
else
Result = new (XCOFFAllocator.Allocate())
MCSectionXCOFF(QualName->getUnqualifiedName(), CsectProp->MappingClass,
return SymInfo.StorageMappingClass.has_value();
if (StorageMappingClass) {
- return getSMCPriority(StorageMappingClass.value()) <
- getSMCPriority(SymInfo.StorageMappingClass.value());
+ return getSMCPriority(*StorageMappingClass) <
+ getSMCPriority(*SymInfo.StorageMappingClass);
}
return false;
size_t FieldIndex = 0;
if (EndToken) {
// Initialize all fields with given initializers.
- while (getTok().isNot(EndToken.value()) &&
- FieldIndex < Structure.Fields.size()) {
+ while (getTok().isNot(*EndToken) && FieldIndex < Structure.Fields.size()) {
const FieldInfo &Field = Structure.Fields[FieldIndex++];
if (parseOptionalToken(AsmToken::Comma)) {
// Empty initializer; use the default and continue. (Also, allow line
FieldInitializers.push_back(Field.Contents);
if (EndToken) {
- if (EndToken.value() == AsmToken::Greater)
+ if (*EndToken == AsmToken::Greater)
return parseAngleBracketClose();
- return parseToken(EndToken.value());
+ return parseToken(*EndToken);
}
return false;
continue;
unsigned NumUnits = SM.getProcResource(I->ProcResourceIdx)->NumUnits;
double Temp = NumUnits * 1.0 / I->Cycles;
- Throughput = Throughput ? std::min(Throughput.value(), Temp) : Temp;
+ Throughput = Throughput ? std::min(*Throughput, Temp) : Temp;
}
if (Throughput)
- return 1.0 / Throughput.value();
+ return 1.0 / *Throughput;
// If no throughput value was calculated, assume that we can execute at the
// maximum issue width scaled by number of micro-ops for the schedule class.
if (!I->getCycles())
continue;
double Temp = countPopulation(I->getUnits()) * 1.0 / I->getCycles();
- Throughput = Throughput ? std::min(Throughput.value(), Temp) : Temp;
+ Throughput = Throughput ? std::min(*Throughput, Temp) : Temp;
}
if (Throughput)
- return 1.0 / Throughput.value();
+ return 1.0 / *Throughput;
// If there are no execution resources specified for this class, then assume
// that it can execute at the maximum default issue width.
// XCOFF debug sections.
if (getKind().isMetadata() && isDwarfSect()) {
- OS << "\n\t.dwsect " << format("0x%" PRIx32, getDwarfSubtypeFlags().value())
+ OS << "\n\t.dwsect " << format("0x%" PRIx32, *getDwarfSubtypeFlags())
<< '\n';
OS << MAI.getPrivateLabelPrefix() << getName() << ':' << '\n';
return;
std::optional<unsigned> Attr =
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
if (Attr)
- isV7 = Attr.value() == ARMBuildAttrs::v7;
+ isV7 = *Attr == ARMBuildAttrs::v7;
Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
case ARMBuildAttrs::ApplicationProfile:
Features.AddFeature("aclass");
break;
Attr = Attributes.getAttributeValue(ARMBuildAttrs::THUMB_ISA_use);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
default:
break;
case ARMBuildAttrs::Not_Allowed:
Attr = Attributes.getAttributeValue(ARMBuildAttrs::FP_arch);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
default:
break;
case ARMBuildAttrs::Not_Allowed:
Attr = Attributes.getAttributeValue(ARMBuildAttrs::Advanced_SIMD_arch);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
default:
break;
case ARMBuildAttrs::Not_Allowed:
Attr = Attributes.getAttributeValue(ARMBuildAttrs::MVE_arch);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
default:
break;
case ARMBuildAttrs::Not_Allowed:
Attr = Attributes.getAttributeValue(ARMBuildAttrs::DIV_use);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
default:
break;
case ARMBuildAttrs::DisallowDIV:
std::optional<unsigned> Attr =
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
if (Attr) {
- switch (Attr.value()) {
+ switch (*Attr) {
case ARMBuildAttrs::v4:
Triple += "v4";
break;
std::optional<unsigned> ArchProfileAttr =
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile);
if (ArchProfileAttr &&
- ArchProfileAttr.value() == ARMBuildAttrs::MicroControllerProfile)
+ *ArchProfileAttr == ARMBuildAttrs::MicroControllerProfile)
Triple += "v7m";
else
Triple += "v7";
const char EnvPathSeparatorStr[] = {Separator, '\0'};
SmallVector<StringRef, 8> Dirs;
- SplitString(OptPath.value(), Dirs, EnvPathSeparatorStr);
+ SplitString(*OptPath, Dirs, EnvPathSeparatorStr);
for (StringRef Dir : Dirs) {
if (Dir.empty())
OS << "{\n"
" 'version': 0,\n";
if (IsCaseSensitive)
- OS << " 'case-sensitive': '"
- << (IsCaseSensitive.value() ? "true" : "false") << "',\n";
+ OS << " 'case-sensitive': '" << (*IsCaseSensitive ? "true" : "false")
+ << "',\n";
if (UseExternalNames)
- OS << " 'use-external-names': '"
- << (UseExternalNames.value() ? "true" : "false") << "',\n";
+ OS << " 'use-external-names': '" << (*UseExternalNames ? "true" : "false")
+ << "',\n";
bool UseOverlayRelative = false;
if (IsOverlayRelative) {
- UseOverlayRelative = IsOverlayRelative.value();
+ UseOverlayRelative = *IsOverlayRelative;
OS << " 'overlay-relative': '" << (UseOverlayRelative ? "true" : "false")
<< "',\n";
}
indent(FB.IndentLevel);
if (FB.FirstByteOffset) {
- uint64_t Offset = FB.FirstByteOffset.value();
+ uint64_t Offset = *FB.FirstByteOffset;
llvm::write_hex(*this, Offset + LineIndex, HPS, OffsetWidth);
*this << ": ";
}
if (!S)
PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName + "'!\n");
- return S.value();
+ return *S;
}
std::optional<StringRef>
ASSERT_TRUE(Value);
EXPECT_EQ(925, cantFail(Value->getSignedValue()));
// getStringValue should return the same memory not just the same characters.
- EXPECT_EQ(StringValue.begin(), FooVar.getStringValue().value().begin());
- EXPECT_EQ(StringValue.end(), FooVar.getStringValue().value().end());
+ EXPECT_EQ(StringValue.begin(), FooVar.getStringValue()->begin());
+ EXPECT_EQ(StringValue.end(), FooVar.getStringValue()->end());
EvalResult = FooVarUse.eval();
ASSERT_THAT_EXPECTED(EvalResult, Succeeded());
EXPECT_EQ(925, cantFail(EvalResult->getSignedValue()));
MaybeAlign A(T.alignment);
// Test Align
if (A) {
- EXPECT_EQ(isAligned(A.value(), T.offset), T.isAligned);
- EXPECT_EQ(isAddrAligned(A.value(), T.forgedAddr()), T.isAligned);
+ EXPECT_EQ(isAligned(*A, T.offset), T.isAligned);
+ EXPECT_EQ(isAddrAligned(*A, T.forgedAddr()), T.isAligned);
}
}
}
EXPECT_EQ(AllSLT || NoneSLT, KnownSLT.has_value());
EXPECT_EQ(AllSLE || NoneSLE, KnownSLE.has_value());
- EXPECT_EQ(AllEQ, KnownEQ.has_value() && KnownEQ.value());
- EXPECT_EQ(AllNE, KnownNE.has_value() && KnownNE.value());
- EXPECT_EQ(AllUGT, KnownUGT.has_value() && KnownUGT.value());
- EXPECT_EQ(AllUGE, KnownUGE.has_value() && KnownUGE.value());
- EXPECT_EQ(AllULT, KnownULT.has_value() && KnownULT.value());
- EXPECT_EQ(AllULE, KnownULE.has_value() && KnownULE.value());
- EXPECT_EQ(AllSGT, KnownSGT.has_value() && KnownSGT.value());
- EXPECT_EQ(AllSGE, KnownSGE.has_value() && KnownSGE.value());
- EXPECT_EQ(AllSLT, KnownSLT.has_value() && KnownSLT.value());
- EXPECT_EQ(AllSLE, KnownSLE.has_value() && KnownSLE.value());
-
- EXPECT_EQ(NoneEQ, KnownEQ.has_value() && !KnownEQ.value());
- EXPECT_EQ(NoneNE, KnownNE.has_value() && !KnownNE.value());
- EXPECT_EQ(NoneUGT, KnownUGT.has_value() && !KnownUGT.value());
- EXPECT_EQ(NoneUGE, KnownUGE.has_value() && !KnownUGE.value());
- EXPECT_EQ(NoneULT, KnownULT.has_value() && !KnownULT.value());
- EXPECT_EQ(NoneULE, KnownULE.has_value() && !KnownULE.value());
- EXPECT_EQ(NoneSGT, KnownSGT.has_value() && !KnownSGT.value());
- EXPECT_EQ(NoneSGE, KnownSGE.has_value() && !KnownSGE.value());
- EXPECT_EQ(NoneSLT, KnownSLT.has_value() && !KnownSLT.value());
- EXPECT_EQ(NoneSLE, KnownSLE.has_value() && !KnownSLE.value());
+ EXPECT_EQ(AllEQ, KnownEQ.has_value() && *KnownEQ);
+ EXPECT_EQ(AllNE, KnownNE.has_value() && *KnownNE);
+ EXPECT_EQ(AllUGT, KnownUGT.has_value() && *KnownUGT);
+ EXPECT_EQ(AllUGE, KnownUGE.has_value() && *KnownUGE);
+ EXPECT_EQ(AllULT, KnownULT.has_value() && *KnownULT);
+ EXPECT_EQ(AllULE, KnownULE.has_value() && *KnownULE);
+ EXPECT_EQ(AllSGT, KnownSGT.has_value() && *KnownSGT);
+ EXPECT_EQ(AllSGE, KnownSGE.has_value() && *KnownSGE);
+ EXPECT_EQ(AllSLT, KnownSLT.has_value() && *KnownSLT);
+ EXPECT_EQ(AllSLE, KnownSLE.has_value() && *KnownSLE);
+
+ EXPECT_EQ(NoneEQ, KnownEQ.has_value() && !*KnownEQ);
+ EXPECT_EQ(NoneNE, KnownNE.has_value() && !*KnownNE);
+ EXPECT_EQ(NoneUGT, KnownUGT.has_value() && !*KnownUGT);
+ EXPECT_EQ(NoneUGE, KnownUGE.has_value() && !*KnownUGE);
+ EXPECT_EQ(NoneULT, KnownULT.has_value() && !*KnownULT);
+ EXPECT_EQ(NoneULE, KnownULE.has_value() && !*KnownULE);
+ EXPECT_EQ(NoneSGT, KnownSGT.has_value() && !*KnownSGT);
+ EXPECT_EQ(NoneSGE, KnownSGE.has_value() && !*KnownSGE);
+ EXPECT_EQ(NoneSLT, KnownSLT.has_value() && !*KnownSLT);
+ EXPECT_EQ(NoneSLE, KnownSLE.has_value() && !*KnownSLE);
});
});
}
<< MatchTable::IntValue(RendererID);
if (SubOperand)
Table << MatchTable::Comment("SubOperand")
- << MatchTable::IntValue(SubOperand.value());
+ << MatchTable::IntValue(*SubOperand);
Table << MatchTable::Comment(SymbolicName) << MatchTable::LineBreak;
}
};
auto Def = DefaultDefOp->getDef();
if (Def->getName() == "undef_tied_input") {
unsigned TempRegID = M.allocateTempRegID();
- M.insertAction<MakeTempRegisterAction>(InsertPt, OpTyOrNone.value(),
+ M.insertAction<MakeTempRegisterAction>(InsertPt, *OpTyOrNone,
TempRegID);
InsertPt = M.insertAction<BuildMIAction>(
InsertPt, M.allocateOutputInsnID(),