diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp index 9260b86298659..a1689dc837bdb 100644 --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -1648,7 +1648,7 @@ void BinaryContext::preprocessDebugInfo() { uint16_t DwarfVersion = LineTable->Prologue.getVersion(); if (DwarfVersion >= 5) { - Optional Checksum = None; + Optional Checksum; if (LineTable->Prologue.ContentTypes.HasMD5) Checksum = LineTable->Prologue.FileNames[0].Checksum; Optional Name = @@ -1686,7 +1686,7 @@ void BinaryContext::preprocessDebugInfo() { if (Optional FName = dwarf::toString(FileNames[I].Name)) FileName = *FName; assert(FileName != ""); - Optional Checksum = None; + Optional Checksum; if (DwarfVersion >= 5 && LineTable->Prologue.ContentTypes.HasMD5) Checksum = LineTable->Prologue.FileNames[I].Checksum; cantFail( diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp index d1fd2b6eb5f7c..ee9b6d2d490d6 100644 --- a/bolt/lib/Rewrite/DWARFRewriter.cpp +++ b/bolt/lib/Rewrite/DWARFRewriter.cpp @@ -1890,8 +1890,8 @@ void DWARFRewriter::convertToRangesPatchDebugInfo( DWARFDie DIE, uint64_t RangesSectionOffset, SimpleBinaryPatcher &DebugInfoPatcher, uint64_t LowPCToUse, Optional RangesBase) { - Optional LowPCVal = None; - Optional HighPCVal = None; + Optional LowPCVal; + Optional HighPCVal; getRangeAttrData(DIE, LowPCVal, HighPCVal); uint64_t LowPCOffset = LowPCVal->Offset; uint64_t HighPCOffset = HighPCVal->Offset; diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp index 307559a403a9a..e54a4f35fd11b 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp @@ -79,7 +79,7 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) { return; QualType TypePtr = MatchedDecl->getType(); - llvm::Optional InitializationString = llvm::None; + llvm::Optional InitializationString; bool AddMathInclude = false; if (TypePtr->isEnumeralType()) diff --git a/clang-tools-extra/clangd/Headers.cpp b/clang-tools-extra/clangd/Headers.cpp index cb7abac3e9f9e..5231a47487bc7 100644 --- a/clang-tools-extra/clangd/Headers.cpp +++ b/clang-tools-extra/clangd/Headers.cpp @@ -352,7 +352,7 @@ IncludeInserter::calculateIncludePath(const HeaderFile &InsertedHeader, llvm::Optional IncludeInserter::insert(llvm::StringRef VerbatimHeader) const { - llvm::Optional Edit = None; + llvm::Optional Edit; if (auto Insertion = Inserter.insert(VerbatimHeader.trim("\"<>"), VerbatimHeader.startswith("<"))) Edit = replacementToEdit(Code, *Insertion); diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 7df4a83b5e8a7..fd6a1799578d8 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3325,7 +3325,7 @@ reformat(const FormatStyle &Style, StringRef Code, NextStartColumn, LastStartColumn); if (!Env) return {}; - llvm::Optional CurrentCode = None; + llvm::Optional CurrentCode; tooling::Replacements Fixes; unsigned Penalty = 0; for (size_t I = 0, E = Passes.size(); I < E; ++I) { diff --git a/clang/lib/Format/QualifierAlignmentFixer.cpp b/clang/lib/Format/QualifierAlignmentFixer.cpp index 61f17cae383ee..174adb160c637 100644 --- a/clang/lib/Format/QualifierAlignmentFixer.cpp +++ b/clang/lib/Format/QualifierAlignmentFixer.cpp @@ -66,7 +66,7 @@ std::pair QualifierAlignmentFixer::analyze( NextStartColumn, LastStartColumn); if (!Env) return {}; - llvm::Optional CurrentCode = None; + llvm::Optional CurrentCode; tooling::Replacements Fixes; for (size_t I = 0, E = Passes.size(); I < E; ++I) { std::pair PassFixes = Passes[I](*Env); diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 5a157d665a9dc..1f5815c1dab6b 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -705,7 +705,7 @@ void FilterAndStoreDiagnosticConsumer::HandleDiagnostic( } if (StandaloneDiags) { - llvm::Optional StoredDiag = None; + llvm::Optional StoredDiag; if (!ResultDiag) { StoredDiag.emplace(Level, Info); ResultDiag = StoredDiag.getPointer(); diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 97d0bba1ea2e1..cc122cdcac927 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -291,7 +291,7 @@ static Optional findSimilarStr( size_t Length = LHS.size(); size_t MaxDist = Length < 3 ? Length - 1 : Length / 3; - Optional> SimilarStr = None; + Optional> SimilarStr; for (StringRef C : Candidates) { size_t CurDist = LHS.edit_distance(C, true); if (CurDist <= MaxDist) { diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 11248d2faadaa..550407e5817ee 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -1728,7 +1728,7 @@ void LinkerDriver::linkerMain(ArrayRef argsArr) { // Handle /opt. bool doGC = debug == DebugKind::None || args.hasArg(OPT_profile); - Optional icfLevel = None; + Optional icfLevel; if (args.hasArg(OPT_profile)) icfLevel = ICFLevel::None; unsigned tailMerge = 1; diff --git a/lldb/source/Core/DumpDataExtractor.cpp b/lldb/source/Core/DumpDataExtractor.cpp index 81544443eb85e..0bf6722340fec 100644 --- a/lldb/source/Core/DumpDataExtractor.cpp +++ b/lldb/source/Core/DumpDataExtractor.cpp @@ -357,7 +357,7 @@ lldb::offset_t lldb_private::DumpDataExtractor( offset_t offset = start_offset; - llvm::Optional memory_tag_map = llvm::None; + llvm::Optional memory_tag_map; if (show_memory_tags && base_addr != LLDB_INVALID_ADDRESS) memory_tag_map = GetMemoryTags(base_addr, DE.GetByteSize() - offset, exe_scope); diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index 973884283f460..b4cdfec25113f 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -384,7 +384,7 @@ InstructionLengthDecode(const uint8_t *inst_bytes, int bytes_len, lldb::InstructionControlFlowKind GetControlFlowKind(bool is_exec_mode_64b, Opcode m_opcode) { - llvm::Optional ret = llvm::None; + llvm::Optional ret; if (m_opcode.GetOpcodeBytes() == nullptr || m_opcode.GetByteSize() <= 0) { // x86_64 and i386 instructions are categorized as Opcode::Type::eTypeBytes diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp index a9a4e98775d93..bc3b42a4ef07a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp @@ -505,7 +505,7 @@ CPlusPlusNameParser::ParseFullNameImpl() { Bookmark start_position = SetBookmark(); State state = State::Beginning; bool continue_parsing = true; - Optional last_coloncolon_position = None; + Optional last_coloncolon_position; while (continue_parsing && HasMoreTokens()) { const auto &token = Peek(); diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp index bc93f4e626d73..21a434e650582 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp @@ -92,7 +92,7 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) { return false; } - llvm::Optional reloc_model = llvm::None; + llvm::Optional reloc_model; assert(m_process_ptr && "no available lldb process"); switch (m_process_ptr->GetTarget().GetArchitecture().GetMachine()) { case llvm::Triple::ArchType::x86: diff --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp index 0444b4da91460..aab2223dd3961 100644 --- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp +++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp @@ -25,7 +25,7 @@ size_t HTRBlockMetadata::GetNumInstructions() const { llvm::Optional HTRBlockMetadata::GetMostFrequentlyCalledFunction() const { size_t max_ncalls = 0; - llvm::Optional max_name = llvm::None; + llvm::Optional max_name; for (const auto &it : m_func_calls) { ConstString name = it.first; size_t ncalls = it.second; @@ -316,7 +316,7 @@ HTRBlockLayerUP lldb_private::BasicSuperBlockMerge(IHTRLayer &layer) { // 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 superblock_head = llvm::None; + llvm::Optional superblock_head; auto construct_next_layer = [&](size_t merge_start, size_t n) -> void { if (!superblock_head) return; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 6f361a49cbf6f..d7dbb306bbecb 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -4374,7 +4374,7 @@ void TargetProperties::CheckJITObjectsDir() { else if (!writable) os << "is not writable"; - llvm::Optional debugger_id = llvm::None; + llvm::Optional debugger_id; if (m_target) debugger_id = m_target->GetDebugger().GetID(); Debugger::ReportError(os.str(), debugger_id); diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 5bd110942597e..b6d8281f42c76 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -8086,7 +8086,7 @@ unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L) { SmallVector ExitingBlocks; L->getExitingBlocks(ExitingBlocks); - Optional Res = None; + Optional Res; for (auto *ExitingBB : ExitingBlocks) { unsigned Multiple = getSmallConstantTripMultiple(L, ExitingBB); if (!Res) @@ -10049,7 +10049,7 @@ SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec, << Bound << " (before multiplying by " << M << ")\n"); Bound *= M; // The quadratic equation multiplier. - Optional SO = None; + Optional SO; if (BitWidth > 1) { LLVM_DEBUG(dbgs() << "SolveQuadraticAddRecRange: solving for " "signed overflow\n"); diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp index 1d16211c65bfd..dd3cac8b8a6fb 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp @@ -761,7 +761,7 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel, // Keep it for later, when we see a MODULE_HASH record uint64_t BlockEntryPos = Stream.getCurrentByteNo(); - Optional BlockName = None; + Optional BlockName; if (DumpRecords) { O->OS << Indent << "<"; if ((BlockName = GetBlockName(BlockID, BlockInfo, CurStreamType))) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index 1c21d5ee8bb1c..ab84a9d8baa49 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -494,7 +494,7 @@ bool DwarfExpression::addExpression( // and not any other parts of the following DWARF expression. assert(!IsEmittingEntryValue && "Can't emit entry value around expression"); - Optional PrevConvertOp = None; + Optional PrevConvertOp; while (ExprCursor) { auto Op = ExprCursor.take(); diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index ddd846c79cd19..424041cef7290 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -1841,7 +1841,7 @@ LegalizerHelper::widenScalarAddSubOverflow(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) { unsigned Opcode; unsigned ExtOpcode; - Optional CarryIn = None; + Optional CarryIn; switch (MI.getOpcode()) { default: llvm_unreachable("Unexpected opcode!"); diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp index e1ee9f8c3502b..677e13dc7629a 100644 --- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp +++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp @@ -1029,7 +1029,7 @@ Optional getAnyConstantSplat(Register VReg, if (!isBuildVectorOp(MI->getOpcode())) return None; - Optional SplatValAndReg = None; + Optional SplatValAndReg; for (MachineOperand &Op : MI->uses()) { Register Element = Op.getReg(); auto ElementValAndReg = diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp index aa3e7a39cf14f..23fde21a31e84 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp @@ -553,7 +553,7 @@ class TransferTracker { // Examine the remaining variable locations: if we can find the same value // again, we can recover the location. - Optional NewLoc = None; + Optional NewLoc; for (auto Loc : MTracker->locations()) if (Loc.Value == OldValue) NewLoc = Loc.Idx; @@ -1145,7 +1145,7 @@ bool InstrRefBasedLDV::transferDebugInstrRef(MachineInstr &MI, // Default machine value number is -- if no instruction defines // the corresponding value, it must have been optimized out. - Optional NewID = None; + Optional NewID; // Try to lookup the instruction number, and find the machine value number // that it defines. It could be an instruction, or a PHI. @@ -1278,7 +1278,7 @@ bool InstrRefBasedLDV::transferDebugInstrRef(MachineInstr &MI, // 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 FoundLoc = None; + Optional FoundLoc; for (auto Location : MTracker->locations()) { LocIdx CurL = Location.Idx; ValueIDNum ID = MTracker->readMLoc(CurL); diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index a7a698744591c..75c2eebbdacd8 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -926,7 +926,7 @@ Optional SelectOptimize::computeInstCost(const Instruction *I) { TTI->getInstructionCost(I, TargetTransformInfo::TCK_Latency); if (auto OC = ICost.getValue()) return Optional(*OC); - return Optional(None); + return Optional(); } ScaledNumber diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 0d203f50e5890..d14a3a11ef74a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -10489,7 +10489,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) { ValueVTs); MVT VT = ValueVTs[0].getSimpleVT(); MVT RegVT = TLI->getRegisterType(*CurDAG->getContext(), VT); - Optional AssertOp = None; + Optional AssertOp; SDValue ArgValue = getCopyFromParts(DAG, dl, &InVals[0], 1, RegVT, VT, nullptr, F.getCallingConv(), AssertOp); diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp index c5c093ae228fd..11dd2e3dcd0f5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp @@ -197,7 +197,7 @@ static Optional findPreviousSpillSlot(const Value *Val, // All incoming values should have same known stack slot, otherwise result // is unknown. if (const PHINode *Phi = dyn_cast(Val)) { - Optional MergedResult = None; + Optional MergedResult; for (const auto &IncomingValue : Phi->incoming_values()) { Optional SpillSlot = diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp index 877380213f215..dc793f07e21b5 100644 --- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp @@ -75,7 +75,7 @@ class SourceCode { SourceCode( StringRef FileName, int64_t Line, int Lines, - const Optional &EmbeddedSource = Optional(None)) + const Optional &EmbeddedSource = Optional()) : Line(Line), Lines(Lines), FirstLine(std::max(static_cast(1), Line - Lines / 2)), LastLine(FirstLine + Lines - 1), diff --git a/llvm/lib/IR/FPEnv.cpp b/llvm/lib/IR/FPEnv.cpp index 48ee84080e98d..4de43f471f3ec 100644 --- a/llvm/lib/IR/FPEnv.cpp +++ b/llvm/lib/IR/FPEnv.cpp @@ -34,7 +34,7 @@ Optional convertStrToRoundingMode(StringRef RoundingArg) { } Optional convertRoundingModeToStr(RoundingMode UseRounding) { - Optional RoundingStr = None; + Optional RoundingStr; switch (UseRounding) { case RoundingMode::Dynamic: RoundingStr = "round.dynamic"; @@ -71,7 +71,7 @@ convertStrToExceptionBehavior(StringRef ExceptionArg) { Optional convertExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) { - Optional ExceptStr = None; + Optional ExceptStr; switch (UseExcept) { case fp::ebStrict: ExceptStr = "fpexcept.strict"; diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 2e32469b4926e..2760f4d8b884d 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -207,7 +207,7 @@ createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) { for (const std::string &A : Conf.MAttrs) Features.AddFeature(A); - Optional RelocModel = None; + Optional RelocModel; if (Conf.RelocModel) RelocModel = *Conf.RelocModel; else if (M.getModuleFlag("PIC Level")) diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 359fbe81989cc..9417f46f44dc3 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -624,7 +624,7 @@ ELFObjectFileBase::getPltAddresses() const { T->createMCInstrAnalysis(MII.get())); if (!MIA) return {}; - Optional Plt = None, RelaPlt = None, GotPlt = None; + Optional Plt, RelaPlt, GotPlt; for (const SectionRef &Section : sections()) { Expected NameOrErr = Section.getName(); if (!NameOrErr) { diff --git a/llvm/lib/Remarks/RemarkLinker.cpp b/llvm/lib/Remarks/RemarkLinker.cpp index cbe966794c497..60794718a5375 100644 --- a/llvm/lib/Remarks/RemarkLinker.cpp +++ b/llvm/lib/Remarks/RemarkLinker.cpp @@ -80,7 +80,7 @@ Error RemarkLinker::link(StringRef Buffer, Optional RemarkFormat) { createRemarkParserFromMeta( *RemarkFormat, Buffer, /*StrTab=*/None, PrependPath ? Optional(StringRef(*PrependPath)) - : Optional(None)); + : Optional()); if (!MaybeParser) return MaybeParser.takeError(); diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp index 1a7ecde384b48..b14ff9549e438 100644 --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -81,7 +81,7 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const { // main thread (8MB) before creation. const llvm::Optional llvm::thread::DefaultStackSize = 8 * 1024 * 1024; #else -const llvm::Optional llvm::thread::DefaultStackSize = None; +const llvm::Optional llvm::thread::DefaultStackSize; #endif diff --git a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp index eaf39fc0dbb11..1b8cd870ebe01 100644 --- a/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp @@ -1522,7 +1522,7 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I, int OffsetStride = IsUnscaled ? TII->getMemScale(FirstMI) : 1; bool IsPromotableZeroStore = isPromotableZeroStoreInst(FirstMI); - Optional MaybeCanRename = None; + Optional MaybeCanRename; if (!EnableRenaming) MaybeCanRename = {false}; diff --git a/llvm/lib/Target/X86/X86DynAllocaExpander.cpp b/llvm/lib/Target/X86/X86DynAllocaExpander.cpp index 357189c5ea8df..e7202df81c743 100644 --- a/llvm/lib/Target/X86/X86DynAllocaExpander.cpp +++ b/llvm/lib/Target/X86/X86DynAllocaExpander.cpp @@ -212,7 +212,7 @@ void X86DynAllocaExpander::lower(MachineInstr *MI, Lowering L) { bool Is64BitAlloca = MI->getOpcode() == X86::DYN_ALLOCA_64; assert(SlotSize == 4 || SlotSize == 8); - Optional InstrNum = None; + Optional InstrNum; if (unsigned Num = MI->peekDebugInstrNum()) { // Operand 2 of DYN_ALLOCAs contains the stack def. InstrNum = {Num, 2}; diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp index 909f2fc568020..1373f1454cb7d 100644 --- a/llvm/lib/Transforms/IPO/IROutliner.cpp +++ b/llvm/lib/Transforms/IPO/IROutliner.cpp @@ -2671,7 +2671,7 @@ void IROutliner::updateOutputMapping(OutlinableRegion &Region, LoadInst *LI) { // For and load instructions following the call Value *Operand = LI->getPointerOperand(); - Optional OutputIdx = None; + Optional OutputIdx; // Find if the operand it is an output register. for (unsigned ArgIdx = Region.NumExtractedInputs; ArgIdx < Region.Call->arg_size(); ArgIdx++) { diff --git a/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp b/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp index c7d54b8cdeb0d..7e71ad6f2de5b 100644 --- a/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp +++ b/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp @@ -101,7 +101,7 @@ PreservedAnalyses SyntheticCountsPropagation::run(Module &M, // parameter. auto GetCallSiteProfCount = [&](const CallGraphNode *, const CallGraphNode::CallRecord &Edge) { - Optional Res = None; + Optional Res; if (!Edge.first) return Res; CallBase &CB = *cast(*Edge.first); diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp index 0eaeae4ee6ba3..f45ac86de7872 100644 --- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp +++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp @@ -534,7 +534,7 @@ void ConstantHoistingPass::collectConstantCandidates(Function &Fn) { // represented in uint64 we return an "empty" APInt. This is then interpreted // as the value is not in range. static Optional calculateOffsetDiff(const APInt &V1, const APInt &V2) { - Optional Res = None; + Optional Res; unsigned BW = V1.getBitWidth() > V2.getBitWidth() ? V1.getBitWidth() : V2.getBitWidth(); uint64_t LimVal1 = V1.getLimitedValue(); diff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp index bb99ef34f3bbc..d937300014ba9 100644 --- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp +++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp @@ -743,7 +743,7 @@ struct LoopFuser { return {false, None}; } - Optional Difference = None; + Optional Difference; int Diff = TC0 - TC1; if (Diff > 0) diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp index 3ccb766b81f61..87b4ce06c1fb1 100644 --- a/llvm/lib/Transforms/Utils/LoopPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp @@ -134,7 +134,7 @@ static Optional calculateIterationsToInvariance( // Place infinity to map to avoid infinite recursion for cycled Phis. Such // cycles can never stop on an invariant. IterationsToInvariance[Phi] = None; - Optional ToInvariance = None; + Optional ToInvariance; if (L->isLoopInvariant(Input)) ToInvariance = 1u; diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index f2a7233caf4dd..065198ff16dad 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -2027,7 +2027,7 @@ class BoUpSLP { LookAheadHeuristics LookAhead(*DL, *SE, *this, /*NumLanes=*/2, RootLookAheadMaxDepth); int BestScore = Limit; - Optional Index = None; + Optional Index; for (int I : seq(0, Candidates.size())) { int Score = LookAhead.getScoreAtLevelRec(Candidates[I].first, Candidates[I].second, diff --git a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index a238b0cf59224..cb86d3c2b332c 100644 --- a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -123,7 +123,7 @@ int main(int argc, char **argv) { O.DumpBlockinfo = DumpBlockinfo; ExitOnErr(BA.analyze( - Dump ? Optional(O) : Optional(None), + Dump ? Optional(O) : Optional(), CheckHash.empty() ? None : Optional(CheckHash))); if (Dump) diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 7eb730ebe941d..a5a86386519ec 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -891,7 +891,7 @@ addMissingWasmCodeSymbols(const WasmObjectFile &Obj, static void addPltEntries(const ObjectFile &Obj, std::map &AllSymbols, StringSaver &Saver) { - Optional Plt = None; + Optional Plt; for (const SectionRef &Section : Obj.sections()) { Expected SecNameOrErr = Section.getName(); if (!SecNameOrErr) { diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index 0e543b5a9e203..78594b19c3c5f 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -7078,7 +7078,7 @@ template void LLVMELFDumper::printBBAddrMaps() { Sec.sh_type != SHT_LLVM_BB_ADDR_MAP_V0) { continue; } - Optional FunctionSec = None; + Optional FunctionSec; if (IsRelocatable) FunctionSec = unwrapOrError(this->FileName, this->Obj.getSection(Sec.sh_link)); diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index 91fa9b2a47905..c9e6eea92367a 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -100,7 +100,7 @@ struct InstRegexOp : public SetTheory::Operator { if (removeParens(Original).find_first_of("|?") != std::string::npos) FirstMeta = 0; - Optional Regexpr = None; + Optional Regexpr; StringRef Prefix = Original.substr(0, FirstMeta); StringRef PatStr = Original.substr(FirstMeta); if (!PatStr.empty()) { diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 4b47cda415674..31c3156ba01d9 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -4536,7 +4536,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( if (ChildTypes.size() != 1) return failedImport("Dst pattern child has multiple results"); - Optional OpTyOrNone = None; + Optional OpTyOrNone; if (ChildTypes.front().isMachineValueType()) OpTyOrNone = MVTToLLT(ChildTypes.front().getMachineValueType().SimpleTy); if (!OpTyOrNone) @@ -4968,7 +4968,7 @@ Error GlobalISelEmitter::importDefaultOperandRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, DagInit *DefaultOps) const { for (const auto *DefaultOp : DefaultOps->getArgs()) { - Optional OpTyOrNone = None; + Optional OpTyOrNone; // Look through ValueType operators. if (const DagInit *DefaultDagOp = dyn_cast(DefaultOp)) { diff --git a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp index 3e19a4940f3a4..b3fe22c503510 100644 --- a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp +++ b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp @@ -1455,7 +1455,7 @@ Optional IntegerRelation::getConstantBoundOnDimSize( /*eqIndices=*/nullptr, /*offset=*/0, /*num=*/getNumDimVars()); - Optional minDiff = None; + Optional minDiff; unsigned minLbPosition = 0, minUbPosition = 0; for (auto ubPos : ubIndices) { for (auto lbPos : lbIndices) { @@ -1538,7 +1538,7 @@ IntegerRelation::computeConstantLowerOrUpperBound(unsigned pos) { // If it doesn't, there isn't a bound on it. return None; - Optional minOrMaxConst = None; + Optional minOrMaxConst; // Take the max across all const lower bounds (or min across all constant // upper bounds). diff --git a/mlir/lib/CAPI/Interfaces/Interfaces.cpp b/mlir/lib/CAPI/Interfaces/Interfaces.cpp index 3f1155fe1ff42..66d3bb187f2e7 100644 --- a/mlir/lib/CAPI/Interfaces/Interfaces.cpp +++ b/mlir/lib/CAPI/Interfaces/Interfaces.cpp @@ -46,7 +46,7 @@ MlirLogicalResult mlirInferTypeOpInterfaceInferReturnTypes( if (!info) return mlirLogicalResultFailure(); - llvm::Optional maybeLocation = llvm::None; + llvm::Optional maybeLocation; if (!mlirLocationIsNull(location)) maybeLocation = unwrap(location); SmallVector unwrappedOperands; diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp index 487cd322a7ec7..81b4e4d65fc45 100644 --- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp @@ -1124,10 +1124,10 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst, // loop nest at 'dstLoopDepth'. uint64_t minFusedLoopNestComputeCost = std::numeric_limits::max(); double maxStorageReduction = 0.0; - Optional sliceMemEstimate = None; + Optional sliceMemEstimate; // The best loop depth at which to materialize the slice. - Optional bestDstLoopDepth = None; + Optional bestDstLoopDepth; // Compute op instance count for the src loop nest without iteration slicing. uint64_t srcLoopNestCost = getComputeCost(srcLoopIVs[0], srcLoopNestStats); @@ -1260,7 +1260,7 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst, auto dstMemSize = getMemoryFootprintBytes(dstForOp); auto srcMemSize = getMemoryFootprintBytes(srcLoopIVs[0]); - Optional storageReduction = None; + Optional storageReduction; if (!dstMemSize || !srcMemSize) { LLVM_DEBUG(llvm::dbgs() diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp index e9f9e75f76290..056f912f86590 100644 --- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp @@ -586,7 +586,7 @@ bufferization::getBufferType(Value value, const BufferizationOptions &options) { // Check value is a new buffer allocation with a memory space attribute. In // that case we can at least infer the memory space. - Optional memorySpace = None; + Optional memorySpace; if (auto opResult = value.dyn_cast()) { if (auto bufferizableOp = options.dynCastBufferizableOp(opResult.getDefiningOp())) {