uint16_t DwarfVersion = LineTable->Prologue.getVersion();
if (DwarfVersion >= 5) {
- Optional<MD5::MD5Result> Checksum = None;
+ Optional<MD5::MD5Result> Checksum;
if (LineTable->Prologue.ContentTypes.HasMD5)
Checksum = LineTable->Prologue.FileNames[0].Checksum;
Optional<const char *> Name =
if (Optional<const char *> FName = dwarf::toString(FileNames[I].Name))
FileName = *FName;
assert(FileName != "");
- Optional<MD5::MD5Result> Checksum = None;
+ Optional<MD5::MD5Result> Checksum;
if (DwarfVersion >= 5 && LineTable->Prologue.ContentTypes.HasMD5)
Checksum = LineTable->Prologue.FileNames[I].Checksum;
cantFail(
DWARFDie DIE, uint64_t RangesSectionOffset,
SimpleBinaryPatcher &DebugInfoPatcher, uint64_t LowPCToUse,
Optional<uint64_t> RangesBase) {
- Optional<AttrInfo> LowPCVal = None;
- Optional<AttrInfo> HighPCVal = None;
+ Optional<AttrInfo> LowPCVal;
+ Optional<AttrInfo> HighPCVal;
getRangeAttrData(DIE, LowPCVal, HighPCVal);
uint64_t LowPCOffset = LowPCVal->Offset;
uint64_t HighPCOffset = HighPCVal->Offset;
return;
QualType TypePtr = MatchedDecl->getType();
- llvm::Optional<const char *> InitializationString = llvm::None;
+ llvm::Optional<const char *> InitializationString;
bool AddMathInclude = false;
if (TypePtr->isEnumeralType())
llvm::Optional<TextEdit>
IncludeInserter::insert(llvm::StringRef VerbatimHeader) const {
- llvm::Optional<TextEdit> Edit = None;
+ llvm::Optional<TextEdit> Edit;
if (auto Insertion = Inserter.insert(VerbatimHeader.trim("\"<>"),
VerbatimHeader.startswith("<")))
Edit = replacementToEdit(Code, *Insertion);
NextStartColumn, LastStartColumn);
if (!Env)
return {};
- llvm::Optional<std::string> CurrentCode = None;
+ llvm::Optional<std::string> CurrentCode;
tooling::Replacements Fixes;
unsigned Penalty = 0;
for (size_t I = 0, E = Passes.size(); I < E; ++I) {
NextStartColumn, LastStartColumn);
if (!Env)
return {};
- llvm::Optional<std::string> CurrentCode = None;
+ llvm::Optional<std::string> CurrentCode;
tooling::Replacements Fixes;
for (size_t I = 0, E = Passes.size(); I < E; ++I) {
std::pair<tooling::Replacements, unsigned> PassFixes = Passes[I](*Env);
}
if (StandaloneDiags) {
- llvm::Optional<StoredDiagnostic> StoredDiag = None;
+ llvm::Optional<StoredDiagnostic> StoredDiag;
if (!ResultDiag) {
StoredDiag.emplace(Level, Info);
ResultDiag = StoredDiag.getPointer();
size_t Length = LHS.size();
size_t MaxDist = Length < 3 ? Length - 1 : Length / 3;
- Optional<std::pair<StringRef, size_t>> SimilarStr = None;
+ Optional<std::pair<StringRef, size_t>> SimilarStr;
for (StringRef C : Candidates) {
size_t CurDist = LHS.edit_distance(C, true);
if (CurDist <= MaxDist) {
// Handle /opt.
bool doGC = debug == DebugKind::None || args.hasArg(OPT_profile);
- Optional<ICFLevel> icfLevel = None;
+ Optional<ICFLevel> icfLevel;
if (args.hasArg(OPT_profile))
icfLevel = ICFLevel::None;
unsigned tailMerge = 1;
offset_t offset = start_offset;
- llvm::Optional<MemoryTagMap> memory_tag_map = llvm::None;
+ llvm::Optional<MemoryTagMap> memory_tag_map;
if (show_memory_tags && base_addr != LLDB_INVALID_ADDRESS)
memory_tag_map =
GetMemoryTags(base_addr, DE.GetByteSize() - offset, exe_scope);
lldb::InstructionControlFlowKind GetControlFlowKind(bool is_exec_mode_64b,
Opcode m_opcode) {
- llvm::Optional<InstructionOpcodeAndModrm> ret = llvm::None;
+ llvm::Optional<InstructionOpcodeAndModrm> ret;
if (m_opcode.GetOpcodeBytes() == nullptr || m_opcode.GetByteSize() <= 0) {
// x86_64 and i386 instructions are categorized as Opcode::Type::eTypeBytes
Bookmark start_position = SetBookmark();
State state = State::Beginning;
bool continue_parsing = true;
- Optional<size_t> last_coloncolon_position = None;
+ Optional<size_t> last_coloncolon_position;
while (continue_parsing && HasMoreTokens()) {
const auto &token = Peek();
return false;
}
- llvm::Optional<llvm::Reloc::Model> reloc_model = llvm::None;
+ llvm::Optional<llvm::Reloc::Model> reloc_model;
assert(m_process_ptr && "no available lldb process");
switch (m_process_ptr->GetTarget().GetArchitecture().GetMachine()) {
case llvm::Triple::ArchType::x86:
llvm::Optional<llvm::StringRef>
HTRBlockMetadata::GetMostFrequentlyCalledFunction() const {
size_t max_ncalls = 0;
- llvm::Optional<llvm::StringRef> max_name = llvm::None;
+ llvm::Optional<llvm::StringRef> max_name;
for (const auto &it : m_func_calls) {
ConstString name = it.first;
size_t ncalls = it.second;
// Each super block always has the same first unit (we call this the
// super block head) This gurantee allows us to use the super block head as
// the unique key mapping to the super block it begins
- llvm::Optional<size_t> superblock_head = llvm::None;
+ llvm::Optional<size_t> superblock_head;
auto construct_next_layer = [&](size_t merge_start, size_t n) -> void {
if (!superblock_head)
return;
else if (!writable)
os << "is not writable";
- llvm::Optional<lldb::user_id_t> debugger_id = llvm::None;
+ llvm::Optional<lldb::user_id_t> debugger_id;
if (m_target)
debugger_id = m_target->GetDebugger().GetID();
Debugger::ReportError(os.str(), debugger_id);
SmallVector<BasicBlock *, 8> ExitingBlocks;
L->getExitingBlocks(ExitingBlocks);
- Optional<unsigned> Res = None;
+ Optional<unsigned> Res;
for (auto *ExitingBB : ExitingBlocks) {
unsigned Multiple = getSmallConstantTripMultiple(L, ExitingBB);
if (!Res)
<< Bound << " (before multiplying by " << M << ")\n");
Bound *= M; // The quadratic equation multiplier.
- Optional<APInt> SO = None;
+ Optional<APInt> SO;
if (BitWidth > 1) {
LLVM_DEBUG(dbgs() << "SolveQuadraticAddRecRange: solving for "
"signed overflow\n");
// Keep it for later, when we see a MODULE_HASH record
uint64_t BlockEntryPos = Stream.getCurrentByteNo();
- Optional<const char *> BlockName = None;
+ Optional<const char *> BlockName;
if (DumpRecords) {
O->OS << Indent << "<";
if ((BlockName = GetBlockName(BlockID, BlockInfo, CurStreamType)))
// and not any other parts of the following DWARF expression.
assert(!IsEmittingEntryValue && "Can't emit entry value around expression");
- Optional<DIExpression::ExprOperand> PrevConvertOp = None;
+ Optional<DIExpression::ExprOperand> PrevConvertOp;
while (ExprCursor) {
auto Op = ExprCursor.take();
LLT WideTy) {
unsigned Opcode;
unsigned ExtOpcode;
- Optional<Register> CarryIn = None;
+ Optional<Register> CarryIn;
switch (MI.getOpcode()) {
default:
llvm_unreachable("Unexpected opcode!");
if (!isBuildVectorOp(MI->getOpcode()))
return None;
- Optional<ValueAndVReg> SplatValAndReg = None;
+ Optional<ValueAndVReg> SplatValAndReg;
for (MachineOperand &Op : MI->uses()) {
Register Element = Op.getReg();
auto ElementValAndReg =
// Examine the remaining variable locations: if we can find the same value
// again, we can recover the location.
- Optional<LocIdx> NewLoc = None;
+ Optional<LocIdx> NewLoc;
for (auto Loc : MTracker->locations())
if (Loc.Value == OldValue)
NewLoc = Loc.Idx;
// Default machine value number is <None> -- if no instruction defines
// the corresponding value, it must have been optimized out.
- Optional<ValueIDNum> NewID = None;
+ Optional<ValueIDNum> NewID;
// Try to lookup the instruction number, and find the machine value number
// that it defines. It could be an instruction, or a PHI.
// Pick a location for the machine value number, if such a location exists.
// (This information could be stored in TransferTracker to make it faster).
- Optional<LocIdx> FoundLoc = None;
+ Optional<LocIdx> FoundLoc;
for (auto Location : MTracker->locations()) {
LocIdx CurL = Location.Idx;
ValueIDNum ID = MTracker->readMLoc(CurL);
TTI->getInstructionCost(I, TargetTransformInfo::TCK_Latency);
if (auto OC = ICost.getValue())
return Optional<uint64_t>(*OC);
- return Optional<uint64_t>(None);
+ return Optional<uint64_t>();
}
ScaledNumber<uint64_t>
ValueVTs);
MVT VT = ValueVTs[0].getSimpleVT();
MVT RegVT = TLI->getRegisterType(*CurDAG->getContext(), VT);
- Optional<ISD::NodeType> AssertOp = None;
+ Optional<ISD::NodeType> AssertOp;
SDValue ArgValue = getCopyFromParts(DAG, dl, &InVals[0], 1, RegVT, VT,
nullptr, F.getCallingConv(), AssertOp);
// All incoming values should have same known stack slot, otherwise result
// is unknown.
if (const PHINode *Phi = dyn_cast<PHINode>(Val)) {
- Optional<int> MergedResult = None;
+ Optional<int> MergedResult;
for (const auto &IncomingValue : Phi->incoming_values()) {
Optional<int> SpillSlot =
SourceCode(
StringRef FileName, int64_t Line, int Lines,
- const Optional<StringRef> &EmbeddedSource = Optional<StringRef>(None))
+ const Optional<StringRef> &EmbeddedSource = Optional<StringRef>())
: Line(Line), Lines(Lines),
FirstLine(std::max(static_cast<int64_t>(1), Line - Lines / 2)),
LastLine(FirstLine + Lines - 1),
}
Optional<StringRef> convertRoundingModeToStr(RoundingMode UseRounding) {
- Optional<StringRef> RoundingStr = None;
+ Optional<StringRef> RoundingStr;
switch (UseRounding) {
case RoundingMode::Dynamic:
RoundingStr = "round.dynamic";
Optional<StringRef>
convertExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) {
- Optional<StringRef> ExceptStr = None;
+ Optional<StringRef> ExceptStr;
switch (UseExcept) {
case fp::ebStrict:
ExceptStr = "fpexcept.strict";
for (const std::string &A : Conf.MAttrs)
Features.AddFeature(A);
- Optional<Reloc::Model> RelocModel = None;
+ Optional<Reloc::Model> RelocModel;
if (Conf.RelocModel)
RelocModel = *Conf.RelocModel;
else if (M.getModuleFlag("PIC Level"))
T->createMCInstrAnalysis(MII.get()));
if (!MIA)
return {};
- Optional<SectionRef> Plt = None, RelaPlt = None, GotPlt = None;
+ Optional<SectionRef> Plt, RelaPlt, GotPlt;
for (const SectionRef &Section : sections()) {
Expected<StringRef> NameOrErr = Section.getName();
if (!NameOrErr) {
createRemarkParserFromMeta(
*RemarkFormat, Buffer, /*StrTab=*/None,
PrependPath ? Optional<StringRef>(StringRef(*PrependPath))
- : Optional<StringRef>(None));
+ : Optional<StringRef>());
if (!MaybeParser)
return MaybeParser.takeError();
// main thread (8MB) before creation.
const llvm::Optional<unsigned> llvm::thread::DefaultStackSize = 8 * 1024 * 1024;
#else
-const llvm::Optional<unsigned> llvm::thread::DefaultStackSize = None;
+const llvm::Optional<unsigned> llvm::thread::DefaultStackSize;
#endif
int OffsetStride = IsUnscaled ? TII->getMemScale(FirstMI) : 1;
bool IsPromotableZeroStore = isPromotableZeroStoreInst(FirstMI);
- Optional<bool> MaybeCanRename = None;
+ Optional<bool> MaybeCanRename;
if (!EnableRenaming)
MaybeCanRename = {false};
bool Is64BitAlloca = MI->getOpcode() == X86::DYN_ALLOCA_64;
assert(SlotSize == 4 || SlotSize == 8);
- Optional<MachineFunction::DebugInstrOperandPair> InstrNum = None;
+ Optional<MachineFunction::DebugInstrOperandPair> InstrNum;
if (unsigned Num = MI->peekDebugInstrNum()) {
// Operand 2 of DYN_ALLOCAs contains the stack def.
InstrNum = {Num, 2};
LoadInst *LI) {
// For and load instructions following the call
Value *Operand = LI->getPointerOperand();
- Optional<unsigned> OutputIdx = None;
+ Optional<unsigned> OutputIdx;
// Find if the operand it is an output register.
for (unsigned ArgIdx = Region.NumExtractedInputs;
ArgIdx < Region.Call->arg_size(); ArgIdx++) {
// parameter.
auto GetCallSiteProfCount = [&](const CallGraphNode *,
const CallGraphNode::CallRecord &Edge) {
- Optional<Scaled64> Res = None;
+ Optional<Scaled64> Res;
if (!Edge.first)
return Res;
CallBase &CB = *cast<CallBase>(*Edge.first);
// represented in uint64 we return an "empty" APInt. This is then interpreted
// as the value is not in range.
static Optional<APInt> calculateOffsetDiff(const APInt &V1, const APInt &V2) {
- Optional<APInt> Res = None;
+ Optional<APInt> Res;
unsigned BW = V1.getBitWidth() > V2.getBitWidth() ?
V1.getBitWidth() : V2.getBitWidth();
uint64_t LimVal1 = V1.getLimitedValue();
return {false, None};
}
- Optional<unsigned> Difference = None;
+ Optional<unsigned> Difference;
int Diff = TC0 - TC1;
if (Diff > 0)
// Place infinity to map to avoid infinite recursion for cycled Phis. Such
// cycles can never stop on an invariant.
IterationsToInvariance[Phi] = None;
- Optional<unsigned> ToInvariance = None;
+ Optional<unsigned> ToInvariance;
if (L->isLoopInvariant(Input))
ToInvariance = 1u;
LookAheadHeuristics LookAhead(*DL, *SE, *this, /*NumLanes=*/2,
RootLookAheadMaxDepth);
int BestScore = Limit;
- Optional<int> Index = None;
+ Optional<int> Index;
for (int I : seq<int>(0, Candidates.size())) {
int Score = LookAhead.getScoreAtLevelRec(Candidates[I].first,
Candidates[I].second,
O.DumpBlockinfo = DumpBlockinfo;
ExitOnErr(BA.analyze(
- Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(None),
+ Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(),
CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));
if (Dump)
static void addPltEntries(const ObjectFile &Obj,
std::map<SectionRef, SectionSymbolsTy> &AllSymbols,
StringSaver &Saver) {
- Optional<SectionRef> Plt = None;
+ Optional<SectionRef> Plt;
for (const SectionRef &Section : Obj.sections()) {
Expected<StringRef> SecNameOrErr = Section.getName();
if (!SecNameOrErr) {
Sec.sh_type != SHT_LLVM_BB_ADDR_MAP_V0) {
continue;
}
- Optional<const Elf_Shdr *> FunctionSec = None;
+ Optional<const Elf_Shdr *> FunctionSec;
if (IsRelocatable)
FunctionSec =
unwrapOrError(this->FileName, this->Obj.getSection(Sec.sh_link));
if (removeParens(Original).find_first_of("|?") != std::string::npos)
FirstMeta = 0;
- Optional<Regex> Regexpr = None;
+ Optional<Regex> Regexpr;
StringRef Prefix = Original.substr(0, FirstMeta);
StringRef PatStr = Original.substr(FirstMeta);
if (!PatStr.empty()) {
if (ChildTypes.size() != 1)
return failedImport("Dst pattern child has multiple results");
- Optional<LLTCodeGen> OpTyOrNone = None;
+ Optional<LLTCodeGen> OpTyOrNone;
if (ChildTypes.front().isMachineValueType())
OpTyOrNone = MVTToLLT(ChildTypes.front().getMachineValueType().SimpleTy);
if (!OpTyOrNone)
action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder,
DagInit *DefaultOps) const {
for (const auto *DefaultOp : DefaultOps->getArgs()) {
- Optional<LLTCodeGen> OpTyOrNone = None;
+ Optional<LLTCodeGen> OpTyOrNone;
// Look through ValueType operators.
if (const DagInit *DefaultDagOp = dyn_cast<DagInit>(DefaultOp)) {
/*eqIndices=*/nullptr, /*offset=*/0,
/*num=*/getNumDimVars());
- Optional<int64_t> minDiff = None;
+ Optional<int64_t> minDiff;
unsigned minLbPosition = 0, minUbPosition = 0;
for (auto ubPos : ubIndices) {
for (auto lbPos : lbIndices) {
// If it doesn't, there isn't a bound on it.
return None;
- Optional<int64_t> minOrMaxConst = None;
+ Optional<int64_t> minOrMaxConst;
// Take the max across all const lower bounds (or min across all constant
// upper bounds).
if (!info)
return mlirLogicalResultFailure();
- llvm::Optional<Location> maybeLocation = llvm::None;
+ llvm::Optional<Location> maybeLocation;
if (!mlirLocationIsNull(location))
maybeLocation = unwrap(location);
SmallVector<Value> unwrappedOperands;
// loop nest at 'dstLoopDepth'.
uint64_t minFusedLoopNestComputeCost = std::numeric_limits<uint64_t>::max();
double maxStorageReduction = 0.0;
- Optional<uint64_t> sliceMemEstimate = None;
+ Optional<uint64_t> sliceMemEstimate;
// The best loop depth at which to materialize the slice.
- Optional<unsigned> bestDstLoopDepth = None;
+ Optional<unsigned> bestDstLoopDepth;
// Compute op instance count for the src loop nest without iteration slicing.
uint64_t srcLoopNestCost = getComputeCost(srcLoopIVs[0], srcLoopNestStats);
auto dstMemSize = getMemoryFootprintBytes(dstForOp);
auto srcMemSize = getMemoryFootprintBytes(srcLoopIVs[0]);
- Optional<double> storageReduction = None;
+ Optional<double> storageReduction;
if (!dstMemSize || !srcMemSize) {
LLVM_DEBUG(llvm::dbgs()
// Check value is a new buffer allocation with a memory space attribute. In
// that case we can at least infer the memory space.
- Optional<unsigned> memorySpace = None;
+ Optional<unsigned> memorySpace;
if (auto opResult = value.dyn_cast<OpResult>()) {
if (auto bufferizableOp =
options.dynCastBufferizableOp(opResult.getDefiningOp())) {