From 7a47ee51a145a40332311330ef45b5d62d8ae023 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 20 Jun 2022 22:45:45 -0700 Subject: [PATCH] [llvm] Don't use Optional::getValue (NFC) --- llvm/include/llvm/ADT/BreadthFirstIterator.h | 2 +- .../include/llvm/Analysis/BlockFrequencyInfoImpl.h | 4 +- llvm/include/llvm/CodeGen/BasicTTIImpl.h | 3 +- .../include/llvm/DebugInfo/CodeView/SymbolRecord.h | 2 +- llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h | 2 +- llvm/include/llvm/Support/YAMLTraits.h | 2 +- llvm/lib/Analysis/BranchProbabilityInfo.cpp | 10 ++--- llvm/lib/Analysis/ConstantFolding.cpp | 2 +- llvm/lib/Analysis/IRSimilarityIdentifier.cpp | 4 +- llvm/lib/Analysis/InlineAdvisor.cpp | 3 +- llvm/lib/Analysis/InlineCost.cpp | 10 ++--- llvm/lib/Analysis/LazyValueInfo.cpp | 2 +- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 2 +- llvm/lib/Analysis/ProfileSummaryInfo.cpp | 6 +-- llvm/lib/Analysis/ScalarEvolution.cpp | 4 +- llvm/lib/Analysis/StackLifetime.cpp | 2 +- llvm/lib/Analysis/SyntheticCountsUtils.cpp | 4 +- llvm/lib/Analysis/ValueTracking.cpp | 3 +- llvm/lib/AsmParser/LLParser.cpp | 2 +- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 +- .../AsmPrinter/DbgEntityHistoryCalculator.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 2 +- llvm/lib/CodeGen/BasicBlockSections.cpp | 2 +- llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | 2 +- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 4 +- llvm/lib/CodeGen/MIRParser/MIParser.cpp | 2 +- llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 4 +- llvm/lib/CodeGen/ModuloSchedule.cpp | 2 +- llvm/lib/CodeGen/SelectOptimize.cpp | 2 +- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 +- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 +- .../CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 10 ++--- llvm/lib/DWP/DWP.cpp | 2 +- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 2 +- llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp | 2 +- llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 3 +- llvm/lib/ExecutionEngine/Orc/Speculation.cpp | 2 +- llvm/lib/IR/AutoUpgrade.cpp | 2 +- llvm/lib/IR/Instructions.cpp | 4 +- llvm/lib/IR/IntrinsicInst.cpp | 4 +- llvm/lib/InterfaceStub/ELFObjHandler.cpp | 7 ++-- llvm/lib/InterfaceStub/IFSHandler.cpp | 4 +- llvm/lib/LTO/LTO.cpp | 2 +- llvm/lib/Linker/IRMover.cpp | 2 +- llvm/lib/MC/MCParser/WasmAsmParser.cpp | 2 +- llvm/lib/MC/XCOFFObjectWriter.cpp | 2 +- llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp | 3 +- llvm/lib/Object/ELFObjectFile.cpp | 2 +- llvm/lib/Object/WasmObjectFile.cpp | 2 +- llvm/lib/Object/XCOFFObjectFile.cpp | 4 +- llvm/lib/ObjectYAML/ELFEmitter.cpp | 2 +- llvm/lib/Support/KnownBits.cpp | 6 +-- llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp | 2 +- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 4 +- llvm/lib/Target/AArch64/AArch64TargetMachine.cpp | 2 +- .../AArch64/GISel/AArch64InstructionSelector.cpp | 2 +- .../AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp | 2 +- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 2 +- llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp | 6 +-- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 2 +- llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp | 2 +- llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 43 ++++++++++------------ llvm/lib/Target/PowerPC/PPCFastISel.cpp | 2 +- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 2 +- .../WebAssembly/AsmParser/WebAssemblyAsmParser.cpp | 7 ++-- .../Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 2 +- llvm/lib/Target/X86/X86DiscriminateMemOps.cpp | 2 +- llvm/lib/Target/X86/X86MCInstLower.cpp | 10 ++--- llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 4 +- llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 12 +++--- llvm/lib/Transforms/IPO/IROutliner.cpp | 6 +-- .../Transforms/InstCombine/InstCombineCasts.cpp | 6 +-- .../Transforms/Instrumentation/InstrProfiling.cpp | 3 +- .../Instrumentation/PGOInstrumentation.cpp | 4 +- llvm/lib/Transforms/Scalar/GVN.cpp | 4 +- .../Scalar/InductiveRangeCheckElimination.cpp | 4 +- llvm/lib/Transforms/Scalar/LoopPredication.cpp | 2 +- .../Transforms/Scalar/RewriteStatepointsForGC.cpp | 2 +- llvm/lib/Transforms/Utils/AddDiscriminators.cpp | 4 +- llvm/lib/Transforms/Utils/Local.cpp | 2 +- llvm/lib/Transforms/Utils/LoopUnroll.cpp | 2 +- llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp | 2 +- llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp | 2 +- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 6 +-- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 6 +-- llvm/lib/Transforms/Vectorize/VPlanSLP.cpp | 2 +- llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp | 2 +- llvm/tools/llvm-ifs/llvm-ifs.cpp | 2 +- llvm/tools/llvm-lto/llvm-lto.cpp | 2 +- llvm/tools/llvm-lto2/llvm-lto2.cpp | 4 +- llvm/tools/llvm-objdump/llvm-objdump.cpp | 4 +- llvm/tools/obj2yaml/dwarf2yaml.cpp | 4 +- 92 files changed, 167 insertions(+), 186 deletions(-) diff --git a/llvm/include/llvm/ADT/BreadthFirstIterator.h b/llvm/include/llvm/ADT/BreadthFirstIterator.h index 1312b5f..807b0a9 100644 --- a/llvm/include/llvm/ADT/BreadthFirstIterator.h +++ b/llvm/include/llvm/ADT/BreadthFirstIterator.h @@ -80,7 +80,7 @@ private: inline void toNext() { Optional Head = VisitQueue.front(); - QueueElement H = Head.getValue(); + QueueElement H = *Head; NodeRef Node = H.first; Optional &ChildIt = H.second; diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h index 256f1b7..d8e524d 100644 --- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h +++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h @@ -1299,7 +1299,7 @@ bool BlockFrequencyInfoImpl::computeMassInLoop(LoopData &Loop) { auto &HeaderNode = Loop.Nodes[H]; assert(!getBlock(HeaderNode)->getIrrLoopHeaderWeight() && "Shouldn't have a weight metadata"); - uint64_t MinWeight = MinHeaderWeight.getValue(); + uint64_t MinWeight = *MinHeaderWeight; LLVM_DEBUG(dbgs() << "Giving weight " << MinWeight << " to " << getBlockName(HeaderNode) << "\n"); if (MinWeight) @@ -1869,7 +1869,7 @@ struct BFIDOTGraphTraitsBase : public DefaultDOTGraphTraits { case GVDT_Count: { auto Count = Graph->getBlockProfileCount(Node); if (Count) - OS << Count.getValue(); + OS << *Count; else OS << "Unknown"; break; diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h index c496f68..6fb3e1a 100644 --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -1307,8 +1307,7 @@ public: // Scale the cost of the load by the fraction of legal instructions that // will be used. - Cost = divideCeil(UsedInsts.count() * Cost.getValue().getValue(), - NumLegalInsts); + Cost = divideCeil(UsedInsts.count() * *Cost.getValue(), NumLegalInsts); } // Then plus the cost of interleave operation. diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h index 67fd602..9513e19 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h @@ -196,7 +196,7 @@ struct BinaryAnnotationIterator const DecodedAnnotation &operator*() { ParseCurrentAnnotation(); - return Current.getValue(); + return *Current; } private: diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h index 392f183..c0d7229 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h @@ -181,7 +181,7 @@ Error iterateSymbolGroups(InputFile &Input, const PrintScope &HeaderScope, FilterOptions Filters = HeaderScope.P.getFilters(); if (Filters.DumpModi) { - uint32_t Modi = Filters.DumpModi.getValue(); + uint32_t Modi = *Filters.DumpModi; SymbolGroup SG(&Input, Modi); return iterateOneModule(Input, withLabelWidth(HeaderScope, NumDigits(Modi)), SG, Modi, Callback); diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 34286dc..dfe9b1b 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -1692,7 +1692,7 @@ void IO::processKeyWithDefault(const char *Key, Optional &Val, if (IsNone) Val = DefaultValue; else - yamlize(*this, Val.getValue(), Required, Ctx); + yamlize(*this, *Val, Required, Ctx); this->postflightKey(SaveInfo); } else { if (UseDefault) diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 3c5566a..1d88042 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -414,8 +414,7 @@ bool BranchProbabilityInfo::calcMetadataWeights(const BasicBlock *BB) { const LoopBlock DstLoopBB = getLoopBlock(TI->getSuccessor(I - 1)); auto EstimatedWeight = getEstimatedEdgeWeight({SrcLoopBB, DstLoopBB}); if (EstimatedWeight && - EstimatedWeight.getValue() <= - static_cast(BlockExecWeight::UNREACHABLE)) + *EstimatedWeight <= static_cast(BlockExecWeight::UNREACHABLE)) UnreachableIdxs.push_back(I - 1); else ReachableIdxs.push_back(I - 1); @@ -688,7 +687,7 @@ Optional BranchProbabilityInfo::getMaxEstimatedEdgeWeight( if (!Weight) return None; - if (!MaxWeight || MaxWeight.getValue() < Weight.getValue()) + if (!MaxWeight || *MaxWeight < *Weight) MaxWeight = Weight; } @@ -852,8 +851,7 @@ void BranchProbabilityInfo::computeEestimateBlockWeight( if (LoopWeight <= static_cast(BlockExecWeight::UNREACHABLE)) LoopWeight = static_cast(BlockExecWeight::LOWEST_NON_ZERO); - EstimatedLoopWeight.insert( - {LoopBB.getLoopData(), LoopWeight.getValue()}); + EstimatedLoopWeight.insert({LoopBB.getLoopData(), *LoopWeight}); // Add all blocks entering the loop into working list. getLoopEnterBlocks(LoopBB, BlockWorkList); } @@ -875,7 +873,7 @@ void BranchProbabilityInfo::computeEestimateBlockWeight( auto MaxWeight = getMaxEstimatedEdgeWeight(LoopBB, successors(BB)); if (MaxWeight) - propagateEstimatedBlockWeight(LoopBB, DT, PDT, MaxWeight.getValue(), + propagateEstimatedBlockWeight(LoopBB, DT, PDT, *MaxWeight, BlockWorkList, LoopWorkList); } } while (!BlockWorkList.empty() || !LoopWorkList.empty()); diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 6b8525a..8a4da83 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -2056,7 +2056,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name, case Intrinsic::experimental_constrained_rint: { auto CI = cast(Call); RM = CI->getRoundingMode(); - if (!RM || RM.getValue() == RoundingMode::Dynamic) + if (!RM || *RM == RoundingMode::Dynamic) return nullptr; break; } diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp index 9d6799b..c945050 100644 --- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp +++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp @@ -1205,7 +1205,7 @@ SimilarityGroupList &IRSimilarityIdentifier::findSimilarity( populateMapper(Modules, InstrList, IntegerMapping); findCandidates(InstrList, IntegerMapping); - return SimilarityCandidates.getValue(); + return *SimilarityCandidates; } SimilarityGroupList &IRSimilarityIdentifier::findSimilarity(Module &M) { @@ -1222,7 +1222,7 @@ SimilarityGroupList &IRSimilarityIdentifier::findSimilarity(Module &M) { populateMapper(M, InstrList, IntegerMapping); findCandidates(InstrList, IntegerMapping); - return SimilarityCandidates.getValue(); + return *SimilarityCandidates; } INITIALIZE_PASS(IRSimilarityIdentifierWrapperPass, "ir-similarity-identifier", diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp index 7a007b5..e2ed297 100644 --- a/llvm/lib/Analysis/InlineAdvisor.cpp +++ b/llvm/lib/Analysis/InlineAdvisor.cpp @@ -578,8 +578,7 @@ const char *InlineAdvisor::getAnnotatedInlinePassName() { // IC is constant and initialized in constructor, so compute the annotated // name only once. - static const std::string PassName = - llvm::AnnotateInlinePassName(IC.getValue()); + static const std::string PassName = llvm::AnnotateInlinePassName(*IC); return PassName.c_str(); } diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index c3451f0..0b2c72e 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -836,7 +836,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { auto *CallerBB = CandidateCall.getParent(); BlockFrequencyInfo *CallerBFI = &(GetBFI(*(CallerBB->getParent()))); CycleSavings += getCallsiteCost(this->CandidateCall, DL); - CycleSavings *= CallerBFI->getBlockProfileCount(CallerBB).getValue(); + CycleSavings *= *CallerBFI->getBlockProfileCount(CallerBB); // Remove the cost of the cold basic blocks. int Size = Cost - ColdSize; @@ -906,7 +906,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { if (auto Result = costBenefitAnalysis()) { DecidedByCostBenefit = true; - if (Result.getValue()) + if (*Result) return InlineResult::success(); else return InlineResult::failure("Cost over threshold."); @@ -998,7 +998,7 @@ public: BoostIndirectCalls(BoostIndirect), IgnoreThreshold(IgnoreThreshold), CostBenefitAnalysisEnabled(isCostBenefitAnalysisEnabled()), Writer(this) { - AllowRecursiveCall = Params.AllowRecursiveCall.getValue(); + AllowRecursiveCall = *Params.AllowRecursiveCall; } /// Annotation Writer for instruction details @@ -1262,7 +1262,7 @@ void InlineCostAnnotationWriter::emitInstructionAnnot( auto C = ICCA->getSimplifiedValue(const_cast(I)); if (C) { OS << ", simplified to "; - C.getValue()->print(OS, true); + (*C)->print(OS, true); } OS << "\n"; } @@ -1855,7 +1855,7 @@ void InlineCostCallAnalyzer::updateThreshold(CallBase &Call, Function &Callee) { // current threshold, but AutoFDO + ThinLTO currently relies on this // behavior to prevent inlining of hot callsites during ThinLTO // compile phase. - Threshold = HotCallSiteThreshold.getValue(); + Threshold = *HotCallSiteThreshold; } else if (isColdCallSite(Call, CallerBFI)) { LLVM_DEBUG(dbgs() << "Cold callsite.\n"); // Do not apply bonuses for a cold callsite including the diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index 85aebbe..5803c3d 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -1353,7 +1353,7 @@ static Optional getEdgeValueLocal(Value *Val, ValueLatticeElement OpLatticeVal = getValueFromCondition(Op, Condition, isTrueDest); if (Optional OpConst = OpLatticeVal.asConstantInteger()) { - Result = constantFoldUser(Usr, Op, OpConst.getValue(), DL); + Result = constantFoldUser(Usr, Op, *OpConst, DL); break; } } diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 8bf70c5..2b98634 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -367,7 +367,7 @@ static void computeFunctionSummary( // We should have named any anonymous globals assert(CalledFunction->hasName()); auto ScaledCount = PSI->getProfileCount(*CB, BFI); - auto Hotness = ScaledCount ? getHotness(ScaledCount.getValue(), PSI) + auto Hotness = ScaledCount ? getHotness(*ScaledCount, PSI) : CalleeInfo::HotnessType::Unknown; if (ForceSummaryEdgesCold != FunctionSummary::FSHT_None) Hotness = CalleeInfo::HotnessType::Cold; diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 992278f..9d5fa6d 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -124,7 +124,7 @@ bool ProfileSummaryInfo::isFunctionHotInCallGraph( for (const auto &I : BB) if (isa(I) || isa(I)) if (auto CallCount = getProfileCount(cast(I), nullptr)) - TotalCallCount += CallCount.getValue(); + TotalCallCount += *CallCount; if (isHotCount(TotalCallCount)) return true; } @@ -153,7 +153,7 @@ bool ProfileSummaryInfo::isFunctionColdInCallGraph( for (const auto &I : BB) if (isa(I) || isa(I)) if (auto CallCount = getProfileCount(cast(I), nullptr)) - TotalCallCount += CallCount.getValue(); + TotalCallCount += *CallCount; if (!isColdCount(TotalCallCount)) return false; } @@ -187,7 +187,7 @@ bool ProfileSummaryInfo::isFunctionHotOrColdInCallGraphNthPercentile( for (const auto &I : BB) if (isa(I) || isa(I)) if (auto CallCount = getProfileCount(cast(I), nullptr)) - TotalCallCount += CallCount.getValue(); + TotalCallCount += *CallCount; if (isHot && isHotCountNthPercentile(PercentileCutoff, TotalCallCount)) return true; if (!isHot && !isColdCountNthPercentile(PercentileCutoff, TotalCallCount)) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index a12c4aea..5eb5c6b 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -9951,7 +9951,7 @@ ScalarEvolution::howFarToZero(const SCEV *V, const Loop *L, bool ControlsExit, // value at this index. When solving for "X*X != 5", for example, we // should not accept a root of 2. if (auto S = SolveQuadraticAddRecExact(AddRec, *this)) { - const auto *R = cast(getConstant(S.getValue())); + const auto *R = cast(getConstant(*S)); return ExitLimit(R, R, false, Predicates); } return getCouldNotCompute(); @@ -12781,7 +12781,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(const ConstantRange &Range, if (isQuadratic()) { if (auto S = SolveQuadraticAddRecRange(this, Range, SE)) - return SE.getConstant(S.getValue()); + return SE.getConstant(*S); } return SE.getCouldNotCompute(); diff --git a/llvm/lib/Analysis/StackLifetime.cpp b/llvm/lib/Analysis/StackLifetime.cpp index bde2e66..52e8566 100644 --- a/llvm/lib/Analysis/StackLifetime.cpp +++ b/llvm/lib/Analysis/StackLifetime.cpp @@ -70,7 +70,7 @@ static const AllocaInst *findMatchingAlloca(const IntrinsicInst &II, auto AllocaSizeInBits = AI->getAllocationSizeInBits(DL); if (!AllocaSizeInBits) return nullptr; - int64_t AllocaSize = AllocaSizeInBits.getValue() / 8; + int64_t AllocaSize = *AllocaSizeInBits / 8; auto *Size = dyn_cast(II.getArgOperand(0)); if (!Size) diff --git a/llvm/lib/Analysis/SyntheticCountsUtils.cpp b/llvm/lib/Analysis/SyntheticCountsUtils.cpp index b250822..29c41fd 100644 --- a/llvm/lib/Analysis/SyntheticCountsUtils.cpp +++ b/llvm/lib/Analysis/SyntheticCountsUtils.cpp @@ -54,7 +54,7 @@ void SyntheticCountsUtils::propagateFromSCC( if (!OptProfCount) continue; auto Callee = CGT::edge_dest(E.second); - AdditionalCounts[Callee] += OptProfCount.getValue(); + AdditionalCounts[Callee] += *OptProfCount; } // Update the counts for the nodes in the SCC. @@ -67,7 +67,7 @@ void SyntheticCountsUtils::propagateFromSCC( if (!OptProfCount) continue; auto Callee = CGT::edge_dest(E.second); - AddCount(Callee, OptProfCount.getValue()); + AddCount(Callee, *OptProfCount); } } diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index bc5bca7..3fa6365 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1755,8 +1755,7 @@ static void computeKnownBitsFromOperator(const Operator *I, break; } - unsigned FirstZeroHighBit = - 32 - countLeadingZeros(VScaleMax.getValue()); + unsigned FirstZeroHighBit = 32 - countLeadingZeros(*VScaleMax); if (FirstZeroHighBit < BitWidth) Known.Zero.setBitsFrom(FirstZeroHighBit); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index a32408b..90e5bff 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -270,7 +270,7 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) { // remangle intrinsics names as well. for (Function &F : llvm::make_early_inc_range(*M)) { if (auto Remangled = Intrinsic::remangleIntrinsicFunction(&F)) { - F.replaceAllUsesWith(Remangled.getValue()); + F.replaceAllUsesWith(*Remangled); F.eraseFromParent(); } } diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 6a7cd68..1bf527f 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3331,7 +3331,7 @@ Error BitcodeReader::globalCleanup() { // Some types could be renamed during loading if several modules are // loaded in the same LLVMContext (LTO scenario). In this case we should // remangle intrinsics names as well. - RemangledIntrinsics[&F] = Remangled.getValue(); + RemangledIntrinsics[&F] = *Remangled; // Look for functions that rely on old function attribute behavior. UpgradeFunctionAttributes(F); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp index 93528e4..1358f4d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp @@ -203,7 +203,7 @@ void DbgValueHistoryMap::trimLocationRanges( if (auto R = intersects(StartMI, EndMI, ScopeRanges, Ordering)) { // Adjust ScopeRanges to exclude ranges which subsequent location ranges // cannot possibly intersect. - ScopeRanges = ArrayRef(R.getValue(), ScopeRanges.end()); + ScopeRanges = ArrayRef(*R, ScopeRanges.end()); } else { // If the location range does not intersect any scope range then the // DBG_VALUE which opened this location range is usless, mark it for diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index db3dc68..81238b0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -799,7 +799,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) { // or reference types. if (DTy->getDWARFAddressSpace()) addUInt(Buffer, dwarf::DW_AT_address_class, dwarf::DW_FORM_data4, - DTy->getDWARFAddressSpace().getValue()); + *DTy->getDWARFAddressSpace()); } void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args) { diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp index 0c28bfb..e6f4e39 100644 --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -245,7 +245,7 @@ assignSections(MachineFunction &MF, if (EHPadsSectionID == MBBSectionID::ExceptionSectionID) for (auto &MBB : MF) if (MBB.isEHPad()) - MBB.setSectionID(EHPadsSectionID.getValue()); + MBB.setSectionID(*EHPadsSectionID); } void llvm::sortBasicBlocksAndUpdateBranches( diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index ffb777e..674649c 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -3973,7 +3973,7 @@ bool CombinerHelper::matchExtractAllEltsFromBuildVector( auto Cst = getIConstantVRegVal(II.getOperand(2).getReg(), MRI); if (!Cst) return false; - unsigned Idx = Cst.getValue().getZExtValue(); + unsigned Idx = Cst->getZExtValue(); if (Idx >= NumElts) return false; // Out of range. ExtractedElts.set(Idx); diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 6cb3787..a2af66d 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -1817,7 +1817,7 @@ static unsigned getConstrainedOpcode(Intrinsic::ID ID) { bool IRTranslator::translateConstrainedFPIntrinsic( const ConstrainedFPIntrinsic &FPI, MachineIRBuilder &MIRBuilder) { - fp::ExceptionBehavior EB = FPI.getExceptionBehavior().getValue(); + fp::ExceptionBehavior EB = *FPI.getExceptionBehavior(); unsigned Opcode = getConstrainedOpcode(FPI.getIntrinsicID()); if (!Opcode) @@ -2264,7 +2264,7 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID, .buildInstr(TargetOpcode::G_INTRINSIC_FPTRUNC_ROUND, {getOrCreateVReg(CI)}, {getOrCreateVReg(*CI.getArgOperand(0))}, Flags) - .addImm((int)RoundMode.getValue()); + .addImm((int)*RoundMode); return true; } diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index aed64d0..879ec00 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -1618,7 +1618,7 @@ bool MIParser::assignRegisterTies(MachineInstr &MI, continue; // The parser ensures that this operand is a register use, so we just have // to check the tied-def operand. - unsigned DefIdx = Operands[I].TiedDefIdx.getValue(); + unsigned DefIdx = *Operands[I].TiedDefIdx; if (DefIdx >= E) return error(Operands[I].Begin, Twine("use of invalid tied-def operand index '" + diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index 85df134..4944cb4 100644 --- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -643,7 +643,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS, // be saved for the caller). if (YamlMF.CalleeSavedRegisters) { SmallVector CalleeSavedRegisters; - for (const auto &RegSource : YamlMF.CalleeSavedRegisters.getValue()) { + for (const auto &RegSource : *YamlMF.CalleeSavedRegisters) { Register Reg; if (parseNamedRegisterReference(PFS, Reg, RegSource.Value, Error)) return error(Error, RegSource.SourceRange); @@ -814,7 +814,7 @@ bool MIRParserImpl::initializeFrameInfo(PerFunctionMIParsingState &PFS, Object.CalleeSavedRestored, ObjectIdx)) return true; if (Object.LocalOffset) - MFI.mapLocalFrameObject(ObjectIdx, Object.LocalOffset.getValue()); + MFI.mapLocalFrameObject(ObjectIdx, *Object.LocalOffset); if (parseStackObjectsDebugInfo(PFS, Object, ObjectIdx)) return true; } diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index 983aff5..8e8cdb2 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -1431,7 +1431,7 @@ Register KernelRewriter::remapUse(Register Reg, MachineInstr &MI) { Register R = MRI.createVirtualRegister(RC); MachineInstr *IllegalPhi = BuildMI(*BB, MI, DebugLoc(), TII->get(TargetOpcode::PHI), R) - .addReg(IllegalPhiDefault.getValue()) + .addReg(*IllegalPhiDefault) .addMBB(PreheaderBB) // Block choice is arbitrary and has no effect. .addReg(LoopReg) .addMBB(BB); // Block choice is arbitrary and has no effect. diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index cd54a09..c199b6a 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -924,7 +924,7 @@ Optional SelectOptimize::computeInstCost(const Instruction *I) { InstructionCost ICost = TTI->getInstructionCost(I, TargetTransformInfo::TCK_Latency); if (auto OC = ICost.getValue()) - return Optional(OC.getValue()); + return Optional(*OC); return Optional(None); } diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 0155330..58df419 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -17928,7 +17928,7 @@ bool DAGCombiner::mergeStoresOfConstantsOrVecElts( if (!UseTrunc) { NewStore = DAG.getStore(NewChain, DL, StoredVal, FirstInChain->getBasePtr(), FirstInChain->getPointerInfo(), - FirstInChain->getAlign(), Flags.getValue(), AAInfo); + FirstInChain->getAlign(), *Flags, AAInfo); } else { // Must be realized as a trunc store EVT LegalizedStoredValTy = TLI.getTypeToTransformTo(*DAG.getContext(), StoredVal.getValueType()); @@ -17940,7 +17940,7 @@ bool DAGCombiner::mergeStoresOfConstantsOrVecElts( NewStore = DAG.getTruncStore( NewChain, DL, ExtendedStoreVal, FirstInChain->getBasePtr(), FirstInChain->getPointerInfo(), StoredVal.getValueType() /*TVT*/, - FirstInChain->getAlign(), Flags.getValue(), AAInfo); + FirstInChain->getAlign(), *Flags, AAInfo); } // Replace all merged stores with the new store. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 7a72999..25a2c31 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5543,7 +5543,7 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, if (!FoldAttempt) return SDValue(); - SDValue Folded = getConstant(FoldAttempt.getValue(), DL, VT); + SDValue Folded = getConstant(*FoldAttempt, DL, VT); assert((!Folded || !VT.isVector()) && "Can't fold vectors ops with scalar operands"); return Folded; @@ -5588,7 +5588,7 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, Optional Fold = FoldValue(Opcode, RawBits1[I], RawBits2[I]); if (!Fold) break; - RawBits.push_back(Fold.getValue()); + RawBits.push_back(*Fold); } if (RawBits.size() == NumElts.getFixedValue()) { // We have constant folded, but we need to cast this again back to diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 674a654..fc031ce 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -337,7 +337,7 @@ static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL, if (IsABIRegCopy) { NumRegs = TLI.getVectorTypeBreakdownForCallingConv( - *DAG.getContext(), CallConv.getValue(), ValueVT, IntermediateVT, + *DAG.getContext(), *CallConv, ValueVT, IntermediateVT, NumIntermediates, RegisterVT); } else { NumRegs = @@ -726,7 +726,7 @@ static void getCopyToPartsVector(SelectionDAG &DAG, const SDLoc &DL, DestEltCnt = ElementCount::getFixed(NumIntermediates); EVT BuiltVectorTy = EVT::getVectorVT( - *DAG.getContext(), IntermediateVT.getScalarType(), DestEltCnt.getValue()); + *DAG.getContext(), IntermediateVT.getScalarType(), *DestEltCnt); if (ValueVT == BuiltVectorTy) { // Nothing to do. @@ -6372,7 +6372,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, SDValue Result; Result = DAG.getNode( ISD::FPTRUNC_ROUND, sdl, VT, getValue(I.getArgOperand(0)), - DAG.getTargetConstant((int)RoundMode.getValue(), sdl, + DAG.getTargetConstant((int)*RoundMode, sdl, TLI.getPointerTy(DAG.getDataLayout()))); setValue(&I, Result); @@ -7303,7 +7303,7 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic( }; SDVTList VTs = DAG.getVTList(ValueVTs); - fp::ExceptionBehavior EB = FPI.getExceptionBehavior().getValue(); + fp::ExceptionBehavior EB = *FPI.getExceptionBehavior(); SDNodeFlags Flags; if (EB == fp::ExceptionBehavior::ebIgnore) @@ -7386,7 +7386,7 @@ static unsigned getISDForVPIntrinsic(const VPIntrinsic &VPIntrin) { : ISD::VP_REDUCE_FMUL; } - return ResOPC.getValue(); + return *ResOPC; } void SelectionDAGBuilder::visitVPLoadGather(const VPIntrinsic &VPIntrin, EVT VT, diff --git a/llvm/lib/DWP/DWP.cpp b/llvm/lib/DWP/DWP.cpp index 4866f80..34615a7 100644 --- a/llvm/lib/DWP/DWP.cpp +++ b/llvm/lib/DWP/DWP.cpp @@ -669,7 +669,7 @@ Error write(MCStreamer &Out, ArrayRef Inputs) { FoundCUUnit = true; } else if (Header.UnitType == dwarf::DW_UT_split_type) { auto P = TypeIndexEntries.insert( - std::make_pair(Header.Signature.getValue(), Entry)); + std::make_pair(*Header.Signature, Entry)); if (!P.second) continue; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 2822d96..c785026 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -389,7 +389,7 @@ void DWARFContext::dump( OS << '\n' << Name << " contents:\n"; if (auto DumpOffset = DumpOffsets[DIDT_ID_DebugInfo]) for (const auto &U : Units) - U->getDIEForOffset(DumpOffset.getValue()) + U->getDIEForOffset(*DumpOffset) .dump(OS, 0, DumpOpts.noImplicitRecursion()); else for (const auto &U : Units) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp index 5bf03ae..80daea6 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp @@ -115,7 +115,7 @@ Error DWARFDebugMacro::parseImpl( if (IsMacro && Data.isValidOffset(Offset)) { // Keep a mapping from Macro contribution to CUs, this will // be needed while retrieving macro from DW_MACRO_define_strx form. - for (const auto &U : Units.getValue()) + for (const auto &U : *Units) if (auto CUDIE = U->getUnitDIE()) // Skip units which does not contibutes to macro section. if (auto MacroOffset = toSectionOffset(CUDIE.find(DW_AT_macros))) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 19863c9..ee99988 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -139,8 +139,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, Color = HighlightColor::String; if (const auto *LT = U->getContext().getLineTableForUnit(U)) if (LT->getFileNameByIndex( - FormValue.getAsUnsignedConstant().getValue(), - U->getCompilationDir(), + *FormValue.getAsUnsignedConstant(), U->getCompilationDir(), DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, File)) { File = '"' + File + '"'; Name = File; diff --git a/llvm/lib/ExecutionEngine/Orc/Speculation.cpp b/llvm/lib/ExecutionEngine/Orc/Speculation.cpp index 0ed3cf3..b52d013 100644 --- a/llvm/lib/ExecutionEngine/Orc/Speculation.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Speculation.cpp @@ -126,7 +126,7 @@ void IRSpeculationLayer::emit(std::unique_ptr R, assert(Mutator.GetInsertBlock()->getParent() == &Fn && "IR builder association mismatch?"); - S.registerSymbols(internToJITSymbols(IRNames.getValue()), + S.registerSymbols(internToJITSymbols(*IRNames), &R->getTargetJITDylib()); } } diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 8028371..622bf54 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -1032,7 +1032,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { // Remangle our intrinsic since we upgrade the mangling auto Result = llvm::Intrinsic::remangleIntrinsicFunction(F); if (Result != None) { - NewFn = Result.getValue(); + NewFn = *Result; return true; } diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 5efd608..22e8ca7 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -4497,7 +4497,7 @@ SwitchInstProfUpdateWrapper::CaseWeightOpt SwitchInstProfUpdateWrapper::getSuccessorWeight(unsigned idx) { if (!Weights) return None; - return Weights.getValue()[idx]; + return (*Weights)[idx]; } void SwitchInstProfUpdateWrapper::setSuccessorWeight( @@ -4509,7 +4509,7 @@ void SwitchInstProfUpdateWrapper::setSuccessorWeight( Weights = SmallVector(SI.getNumSuccessors(), 0); if (Weights) { - auto &OldW = Weights.getValue()[idx]; + auto &OldW = (*Weights)[idx]; if (*W != OldW) { Changed = true; OldW = *W; diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp index 5deb3a5..ac03b14 100644 --- a/llvm/lib/IR/IntrinsicInst.cpp +++ b/llvm/lib/IR/IntrinsicInst.cpp @@ -314,7 +314,7 @@ ElementCount VPIntrinsic::getStaticVectorLength() const { Value *VPIntrinsic::getMaskParam() const { if (auto MaskPos = getMaskParamPos(getIntrinsicID())) - return getArgOperand(MaskPos.getValue()); + return getArgOperand(*MaskPos); return nullptr; } @@ -325,7 +325,7 @@ void VPIntrinsic::setMaskParam(Value *NewMask) { Value *VPIntrinsic::getVectorLengthParam() const { if (auto EVLPos = getVectorLengthParamPos(getIntrinsicID())) - return getArgOperand(EVLPos.getValue()); + return getArgOperand(*EVLPos); return nullptr; } diff --git a/llvm/lib/InterfaceStub/ELFObjHandler.cpp b/llvm/lib/InterfaceStub/ELFObjHandler.cpp index 55e64d1..13801cd 100644 --- a/llvm/lib/InterfaceStub/ELFObjHandler.cpp +++ b/llvm/lib/InterfaceStub/ELFObjHandler.cpp @@ -194,7 +194,7 @@ public: for (const std::string &Lib : Stub.NeededLibs) DynStr.Content.add(Lib); if (Stub.SoName) - DynStr.Content.add(Stub.SoName.getValue()); + DynStr.Content.add(*Stub.SoName); std::vector *> Sections = {&DynSym, &DynStr, &DynTab, &ShStrTab}; @@ -231,7 +231,7 @@ public: DynTab.Content.addValue(DT_NEEDED, DynStr.Content.getOffset(Lib)); if (Stub.SoName) DynTab.Content.addValue(DT_SONAME, - DynStr.Content.getOffset(Stub.SoName.getValue())); + DynStr.Content.getOffset(*Stub.SoName)); DynTab.Size = DynTab.Content.getSize(); // Calculate sections' addresses and offsets. uint64_t CurrentOffset = sizeof(Elf_Ehdr); @@ -250,8 +250,7 @@ public: fillStrTabShdr(ShStrTab); // Finish initializing the ELF header. - initELFHeader(ElfHeader, - static_cast(Stub.Target.Arch.getValue())); + initELFHeader(ElfHeader, static_cast(*Stub.Target.Arch)); ElfHeader.e_shstrndx = ShStrTab.Index; ElfHeader.e_shnum = LastSection->Index + 1; ElfHeader.e_shoff = diff --git a/llvm/lib/InterfaceStub/IFSHandler.cpp b/llvm/lib/InterfaceStub/IFSHandler.cpp index 4a784c7..71189e7 100644 --- a/llvm/lib/InterfaceStub/IFSHandler.cpp +++ b/llvm/lib/InterfaceStub/IFSHandler.cpp @@ -193,7 +193,7 @@ Expected> ifs::readIFSFromBuffer(StringRef Buf) { std::make_error_code(std::errc::invalid_argument)); if (Stub->Target.ArchString) { Stub->Target.Arch = - ELF::convertArchNameToEMachine(Stub->Target.ArchString.getValue()); + ELF::convertArchNameToEMachine(*Stub->Target.ArchString); } return std::move(Stub); } @@ -266,7 +266,7 @@ Error ifs::validateIFSTarget(IFSStub &Stub, bool ParseTriple) { ValidationEC); } if (ParseTriple) { - IFSTarget TargetFromTriple = parseTriple(Stub.Target.Triple.getValue()); + IFSTarget TargetFromTriple = parseTriple(*Stub.Target.Triple); Stub.Target.Arch = TargetFromTriple.Arch; Stub.Target.BitWidth = TargetFromTriple.BitWidth; Stub.Target.Endianness = TargetFromTriple.Endianness; diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index b9c1cf9..8d1570f 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -643,7 +643,7 @@ Error LTO::addModule(InputFile &Input, unsigned ModI, // If only some modules were split, flag this in the index so that // we can skip or error on optimizations that need consistently split // modules (whole program devirt and lower type tests). - if (EnableSplitLTOUnit.getValue() != LTOInfo->EnableSplitLTOUnit) + if (*EnableSplitLTOUnit != LTOInfo->EnableSplitLTOUnit) ThinLTO.CombinedIndex.setPartiallySplitLTOUnits(); } else EnableSplitLTOUnit = LTOInfo->EnableSplitLTOUnit; diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 05b71d1..5a819e2 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1046,7 +1046,7 @@ Expected IRLinker::linkGlobalValueProto(GlobalValue *SGV, if (Function *F = dyn_cast(NewGV)) if (auto Remangled = Intrinsic::remangleIntrinsicFunction(F)) { NewGV->eraseFromParent(); - NewGV = Remangled.getValue(); + NewGV = *Remangled; NeedsRenaming = false; } diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp index e7c2886..a84d00d 100644 --- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp +++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp @@ -188,7 +188,7 @@ public: // TODO: Parse UniqueID MCSectionWasm *WS = getContext().getWasmSection( - Name, Kind.getValue(), Flags, GroupName, MCContext::GenericSectionID); + Name, *Kind, Flags, GroupName, MCContext::GenericSectionID); if (WS->getSegmentFlags() != Flags) Parser->Error(loc, "changed section flags for " + Name + diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp index 9df54d3..9e24134 100644 --- a/llvm/lib/MC/XCOFFObjectWriter.cpp +++ b/llvm/lib/MC/XCOFFObjectWriter.cpp @@ -448,7 +448,7 @@ void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm, SectionMap[MCSec] = DwarfSec.get(); DwarfSectionEntry SecEntry(MCSec->getName(), - MCSec->getDwarfSubtypeFlags().getValue(), + *MCSec->getDwarfSubtypeFlags(), std::move(DwarfSec)); DwarfSections.push_back(std::move(SecEntry)); } else diff --git a/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp b/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp index 8ba0c77..5db03a4 100644 --- a/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp +++ b/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp @@ -264,8 +264,7 @@ static Error processLoadCommands(const MachOConfig &MachOConfig, Object &Obj) { if (LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_SEGMENT_64 || LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_SEGMENT) { return LC.Sections.empty() && - MachOConfig.EmptySegmentsToRemove.contains( - LC.getSegmentName().getValue()); + MachOConfig.EmptySegmentsToRemove.contains(*LC.getSegmentName()); } return false; }; diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 319b69a..9bac454 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -307,7 +307,7 @@ SubtargetFeatures ELFObjectFileBase::getRISCVFeatures() const { // The Arch pattern is [rv32|rv64][i|e]version(_[m|a|f|d|c]version)* // Version string pattern is (major)p(minor). Major and minor are optional. // For example, a version number could be 2p0, 2, or p92. - StringRef Arch = Attr.getValue(); + StringRef Arch = *Attr; if (Arch.consume_front("rv32")) Features.AddFeature("64bit", false); else if (Arch.consume_front("rv64")) diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 0e99c21..cc80ae9 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -1520,7 +1520,7 @@ Error WasmObjectFile::parseElemSection(ReadContext &Ctx) { Error WasmObjectFile::parseDataSection(ReadContext &Ctx) { DataSection = Sections.size(); uint32_t Count = readVaruint32(Ctx); - if (DataCount && Count != DataCount.getValue()) + if (DataCount && Count != *DataCount) return make_error( "number of data segments does not match DataCount section"); DataSegments.reserve(Count); diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp index 5e699e9..ff39fe1 100644 --- a/llvm/lib/Object/XCOFFObjectFile.cpp +++ b/llvm/lib/Object/XCOFFObjectFile.cpp @@ -1342,7 +1342,7 @@ XCOFFTracebackTable::XCOFFTracebackTable(const uint8_t *Ptr, uint64_t &Size, NumOfCtlAnchors = DE.getU32(Cur); if (Cur && NumOfCtlAnchors) { SmallVector Disp; - Disp.reserve(NumOfCtlAnchors.getValue()); + Disp.reserve(*NumOfCtlAnchors); for (uint32_t I = 0; I < NumOfCtlAnchors && Cur; ++I) Disp.push_back(DE.getU32(Cur)); if (Cur) @@ -1369,7 +1369,7 @@ XCOFFTracebackTable::XCOFFTracebackTable(const uint8_t *Ptr, uint64_t &Size, return; } VecExt = TBVecExtOrErr.get(); - VectorParmsNum = VecExt.getValue().getNumberOfVectorParms(); + VectorParmsNum = VecExt->getNumberOfVectorParms(); } } diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index 0182989..d86005c 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -596,7 +596,7 @@ unsigned ELFState::toSectionIndex(StringRef S, StringRef LocSec, const ELFYAML::SectionHeaderTable &SectionHeaders = Doc.getSectionHeaderTable(); if (SectionHeaders.IsImplicit || - (SectionHeaders.NoHeaders && !SectionHeaders.NoHeaders.getValue()) || + (SectionHeaders.NoHeaders && !*SectionHeaders.NoHeaders) || SectionHeaders.isDefault()) return Index; diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp index 9f200c2..9f34405 100644 --- a/llvm/lib/Support/KnownBits.cpp +++ b/llvm/lib/Support/KnownBits.cpp @@ -340,7 +340,7 @@ Optional KnownBits::eq(const KnownBits &LHS, const KnownBits &RHS) { Optional KnownBits::ne(const KnownBits &LHS, const KnownBits &RHS) { if (Optional KnownEQ = eq(LHS, RHS)) - return Optional(!KnownEQ.getValue()); + return Optional(!*KnownEQ); return None; } @@ -356,7 +356,7 @@ Optional KnownBits::ugt(const KnownBits &LHS, const KnownBits &RHS) { Optional KnownBits::uge(const KnownBits &LHS, const KnownBits &RHS) { if (Optional IsUGT = ugt(RHS, LHS)) - return Optional(!IsUGT.getValue()); + return Optional(!*IsUGT); return None; } @@ -380,7 +380,7 @@ Optional KnownBits::sgt(const KnownBits &LHS, const KnownBits &RHS) { Optional KnownBits::sge(const KnownBits &LHS, const KnownBits &RHS) { if (Optional KnownSGT = sgt(RHS, LHS)) - return Optional(!KnownSGT.getValue()); + return Optional(!*KnownSGT); return None; } diff --git a/llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp b/llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp index 8fbb71f..5c7fb0d 100644 --- a/llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp +++ b/llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp @@ -415,7 +415,7 @@ bool AArch64MIPeepholeOpt::splitTwoPartImm( Imm &= 0xFFFFFFFF; OpcodePair Opcode; if (auto R = SplitAndOpc(Imm, RegSize, Imm0, Imm1)) - Opcode = R.getValue(); + Opcode = *R; else return false; diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index 89c0e42..12eb1d2 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -417,7 +417,7 @@ bool AArch64StackTagging::isInterestingAlloca(const AllocaInst &AI) { bool IsInteresting = AI.getAllocatedType()->isSized() && AI.isStaticAlloca() && // alloca() may be called with 0 size, ignore it. - AI.getAllocationSizeInBits(*DL).getValue() > 0 && + *AI.getAllocationSizeInBits(*DL) > 0 && // inalloca allocas are not treated as static, and we don't want // dynamic alloca instrumentation for them as well. !AI.isUsedWithInAlloca() && @@ -573,7 +573,7 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) { End->eraseFromParent(); } } else { - uint64_t Size = Info.AI->getAllocationSizeInBits(*DL).getValue() / 8; + uint64_t Size = *Info.AI->getAllocationSizeInBits(*DL) / 8; Value *Ptr = IRB.CreatePointerCast(TagPCall, IRB.getInt8PtrTy()); tagAlloca(AI, &*IRB.GetInsertPoint(), Ptr, Size); for (auto &RI : SInfo.RetVec) { diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp index fd34bc3..3f9795f 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp @@ -392,7 +392,7 @@ AArch64TargetMachine::getSubtargetImpl(const Function &F) const { if (VScaleRangeAttr.isValid()) { Optional VScaleMax = VScaleRangeAttr.getVScaleRangeMax(); MinSVEVectorSize = VScaleRangeAttr.getVScaleRangeMin() * 128; - MaxSVEVectorSize = VScaleMax ? VScaleMax.getValue() * 128 : 0; + MaxSVEVectorSize = VScaleMax ? *VScaleMax * 128 : 0; } else { MinSVEVectorSize = SVEVectorBitsMinOpt; MaxSVEVectorSize = SVEVectorBitsMaxOpt; diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp index fbeebe2..9a656877 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp @@ -6743,7 +6743,7 @@ void AArch64InstructionSelector::renderTruncImm(MachineInstrBuilder &MIB, Optional CstVal = getIConstantVRegSExtVal(MI.getOperand(0).getReg(), MRI); assert(CstVal && "Expected constant value"); - MIB.addImm(CstVal.getValue()); + MIB.addImm(*CstVal); } void AArch64InstructionSelector::renderLogicalImm32( diff --git a/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp index eb9ed61e..4d7a3f4 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp @@ -442,7 +442,7 @@ class CollectReachableCallees { continue; for (const auto &GI : *CGN) { - auto *RCB = cast(GI.first.getValue()); + auto *RCB = cast(*GI.first); auto *RCGN = GI.second; if (auto *DCallee = RCGN->getFunction()) { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index dc77b2c..8f01a8b 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1514,7 +1514,7 @@ bool GCNTargetMachine::parseMachineFunctionInfo( Arg = ArgDescriptor::createStack(A->StackOffset); // Check and apply the optional mask. if (A->Mask) - Arg = ArgDescriptor::createArg(Arg, A->Mask.getValue()); + Arg = ArgDescriptor::createArg(Arg, *A->Mask); MFI->NumUserSGPRs += UserSGPRs; MFI->NumSystemSGPRs += SystemSGPRs; diff --git a/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp b/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp index 1e23cfa..8a66213 100644 --- a/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp +++ b/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp @@ -714,7 +714,7 @@ Optional SIMemOpAccess::constructFromMIWithMMO( return None; } - SSID = IsSyncScopeInclusion.getValue() ? SSID : MMO->getSyncScopeID(); + SSID = *IsSyncScopeInclusion ? SSID : MMO->getSyncScopeID(); Ordering = getMergedAtomicOrdering(Ordering, OpOrdering); assert(MMO->getFailureOrdering() != AtomicOrdering::Release && MMO->getFailureOrdering() != AtomicOrdering::AcquireRelease); @@ -733,7 +733,7 @@ Optional SIMemOpAccess::constructFromMIWithMMO( return None; } std::tie(Scope, OrderingAddrSpace, IsCrossAddressSpaceOrdering) = - ScopeOrNone.getValue(); + *ScopeOrNone; if ((OrderingAddrSpace == SIAtomicAddrSpace::NONE) || ((OrderingAddrSpace & SIAtomicAddrSpace::ATOMIC) != OrderingAddrSpace) || ((InstrAddrSpace & SIAtomicAddrSpace::ATOMIC) == SIAtomicAddrSpace::NONE)) { @@ -795,7 +795,7 @@ Optional SIMemOpAccess::getAtomicFenceInfo( SIAtomicAddrSpace OrderingAddrSpace = SIAtomicAddrSpace::NONE; bool IsCrossAddressSpaceOrdering = false; std::tie(Scope, OrderingAddrSpace, IsCrossAddressSpaceOrdering) = - ScopeOrNone.getValue(); + *ScopeOrNone; if ((OrderingAddrSpace == SIAtomicAddrSpace::NONE) || ((OrderingAddrSpace & SIAtomicAddrSpace::ATOMIC) != OrderingAddrSpace)) { diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 22fd29a3..b725ea3 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -11385,7 +11385,7 @@ bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) { Error(TagLoc, "attribute name not recognised: " + Name); return false; } - Tag = Ret.getValue(); + Tag = *Ret; Parser.Lex(); } else { const MCExpr *AttrExpr; diff --git a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp index 2ac809d..f67bfbf 100644 --- a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp +++ b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp @@ -390,7 +390,7 @@ MVEGatherScatterLowering::getVarAndConst(Value *Inst, int TypeScale) { return ReturnFalse; // Check that the constant is small enough for an incrementing gather - int64_t Immediate = Const.getValue() << TypeScale; + int64_t Immediate = *Const << TypeScale; if (Immediate > 512 || Immediate < -512 || Immediate % 4 != 0) return ReturnFalse; diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp index dfa84bc..48fa387 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp @@ -923,8 +923,7 @@ bool NVPTXDAGToDAGISel::tryLoad(SDNode *N) { SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(CodeAddrSpace, dl), getI32Imm(vecType, dl), getI32Imm(fromType, dl), getI32Imm(fromTypeWidth, dl), Addr, Chain }; - NVPTXLD = CurDAG->getMachineNode(Opcode.getValue(), dl, TargetVT, - MVT::Other, Ops); + NVPTXLD = CurDAG->getMachineNode(*Opcode, dl, TargetVT, MVT::Other, Ops); } else if (PointerSize == 64 ? SelectADDRsi64(N1.getNode(), N1, Base, Offset) : SelectADDRsi(N1.getNode(), N1, Base, Offset)) { Opcode = pickOpcodeForVT(TargetVT, NVPTX::LD_i8_asi, NVPTX::LD_i16_asi, @@ -936,8 +935,7 @@ bool NVPTXDAGToDAGISel::tryLoad(SDNode *N) { SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(CodeAddrSpace, dl), getI32Imm(vecType, dl), getI32Imm(fromType, dl), getI32Imm(fromTypeWidth, dl), Base, Offset, Chain }; - NVPTXLD = CurDAG->getMachineNode(Opcode.getValue(), dl, TargetVT, - MVT::Other, Ops); + NVPTXLD = CurDAG->getMachineNode(*Opcode, dl, TargetVT, MVT::Other, Ops); } else if (PointerSize == 64 ? SelectADDRri64(N1.getNode(), N1, Base, Offset) : SelectADDRri(N1.getNode(), N1, Base, Offset)) { if (PointerSize == 64) @@ -955,8 +953,7 @@ bool NVPTXDAGToDAGISel::tryLoad(SDNode *N) { SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(CodeAddrSpace, dl), getI32Imm(vecType, dl), getI32Imm(fromType, dl), getI32Imm(fromTypeWidth, dl), Base, Offset, Chain }; - NVPTXLD = CurDAG->getMachineNode(Opcode.getValue(), dl, TargetVT, - MVT::Other, Ops); + NVPTXLD = CurDAG->getMachineNode(*Opcode, dl, TargetVT, MVT::Other, Ops); } else { if (PointerSize == 64) Opcode = pickOpcodeForVT( @@ -974,8 +971,7 @@ bool NVPTXDAGToDAGISel::tryLoad(SDNode *N) { SDValue Ops[] = { getI32Imm(isVolatile, dl), getI32Imm(CodeAddrSpace, dl), getI32Imm(vecType, dl), getI32Imm(fromType, dl), getI32Imm(fromTypeWidth, dl), N1, Chain }; - NVPTXLD = CurDAG->getMachineNode(Opcode.getValue(), dl, TargetVT, - MVT::Other, Ops); + NVPTXLD = CurDAG->getMachineNode(*Opcode, dl, TargetVT, MVT::Other, Ops); } if (!NVPTXLD) @@ -1092,7 +1088,7 @@ bool NVPTXDAGToDAGISel::tryLoadVector(SDNode *N) { SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL), getI32Imm(VecType, DL), getI32Imm(FromType, DL), getI32Imm(FromTypeWidth, DL), Addr, Chain }; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, N->getVTList(), Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, N->getVTList(), Ops); } else if (PointerSize == 64 ? SelectADDRsi64(Op1.getNode(), Op1, Base, Offset) : SelectADDRsi(Op1.getNode(), Op1, Base, Offset)) { @@ -1119,7 +1115,7 @@ bool NVPTXDAGToDAGISel::tryLoadVector(SDNode *N) { SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL), getI32Imm(VecType, DL), getI32Imm(FromType, DL), getI32Imm(FromTypeWidth, DL), Base, Offset, Chain }; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, N->getVTList(), Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, N->getVTList(), Ops); } else if (PointerSize == 64 ? SelectADDRri64(Op1.getNode(), Op1, Base, Offset) : SelectADDRri(Op1.getNode(), Op1, Base, Offset)) { @@ -1169,7 +1165,7 @@ bool NVPTXDAGToDAGISel::tryLoadVector(SDNode *N) { getI32Imm(VecType, DL), getI32Imm(FromType, DL), getI32Imm(FromTypeWidth, DL), Base, Offset, Chain }; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, N->getVTList(), Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, N->getVTList(), Ops); } else { if (PointerSize == 64) { switch (N->getOpcode()) { @@ -1217,7 +1213,7 @@ bool NVPTXDAGToDAGISel::tryLoadVector(SDNode *N) { SDValue Ops[] = { getI32Imm(IsVolatile, DL), getI32Imm(CodeAddrSpace, DL), getI32Imm(VecType, DL), getI32Imm(FromType, DL), getI32Imm(FromTypeWidth, DL), Op1, Chain }; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, N->getVTList(), Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, N->getVTList(), Ops); } MachineMemOperand *MemRef = cast(N)->getMemOperand(); @@ -1361,7 +1357,7 @@ bool NVPTXDAGToDAGISel::tryLDGLDU(SDNode *N) { if (!Opcode) return false; SDValue Ops[] = { Addr, Chain }; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, InstVTList, Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, InstVTList, Ops); } else if (TM.is64Bit() ? SelectADDRri64(Op1.getNode(), Op1, Base, Offset) : SelectADDRri(Op1.getNode(), Op1, Base, Offset)) { if (TM.is64Bit()) { @@ -1508,7 +1504,7 @@ bool NVPTXDAGToDAGISel::tryLDGLDU(SDNode *N) { if (!Opcode) return false; SDValue Ops[] = {Base, Offset, Chain}; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, InstVTList, Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, InstVTList, Ops); } else { if (TM.is64Bit()) { switch (N->getOpcode()) { @@ -1654,7 +1650,7 @@ bool NVPTXDAGToDAGISel::tryLDGLDU(SDNode *N) { if (!Opcode) return false; SDValue Ops[] = { Op1, Chain }; - LD = CurDAG->getMachineNode(Opcode.getValue(), DL, InstVTList, Ops); + LD = CurDAG->getMachineNode(*Opcode, DL, InstVTList, Ops); } MachineMemOperand *MemRef = Mem->getMemOperand(); @@ -1787,7 +1783,7 @@ bool NVPTXDAGToDAGISel::tryStore(SDNode *N) { getI32Imm(toTypeWidth, dl), Addr, Chain}; - NVPTXST = CurDAG->getMachineNode(Opcode.getValue(), dl, MVT::Other, Ops); + NVPTXST = CurDAG->getMachineNode(*Opcode, dl, MVT::Other, Ops); } else if (PointerSize == 64 ? SelectADDRsi64(BasePtr.getNode(), BasePtr, Base, Offset) : SelectADDRsi(BasePtr.getNode(), BasePtr, Base, Offset)) { @@ -1806,7 +1802,7 @@ bool NVPTXDAGToDAGISel::tryStore(SDNode *N) { Base, Offset, Chain}; - NVPTXST = CurDAG->getMachineNode(Opcode.getValue(), dl, MVT::Other, Ops); + NVPTXST = CurDAG->getMachineNode(*Opcode, dl, MVT::Other, Ops); } else if (PointerSize == 64 ? SelectADDRri64(BasePtr.getNode(), BasePtr, Base, Offset) : SelectADDRri(BasePtr.getNode(), BasePtr, Base, Offset)) { @@ -1832,7 +1828,7 @@ bool NVPTXDAGToDAGISel::tryStore(SDNode *N) { Base, Offset, Chain}; - NVPTXST = CurDAG->getMachineNode(Opcode.getValue(), dl, MVT::Other, Ops); + NVPTXST = CurDAG->getMachineNode(*Opcode, dl, MVT::Other, Ops); } else { if (PointerSize == 64) Opcode = @@ -1855,7 +1851,7 @@ bool NVPTXDAGToDAGISel::tryStore(SDNode *N) { getI32Imm(toTypeWidth, dl), BasePtr, Chain}; - NVPTXST = CurDAG->getMachineNode(Opcode.getValue(), dl, MVT::Other, Ops); + NVPTXST = CurDAG->getMachineNode(*Opcode, dl, MVT::Other, Ops); } if (!NVPTXST) @@ -2082,7 +2078,7 @@ bool NVPTXDAGToDAGISel::tryStoreVector(SDNode *N) { StOps.push_back(Chain); - ST = CurDAG->getMachineNode(Opcode.getValue(), DL, MVT::Other, StOps); + ST = CurDAG->getMachineNode(*Opcode, DL, MVT::Other, StOps); MachineMemOperand *MemRef = cast(N)->getMemOperand(); CurDAG->setNodeMemRefs(cast(ST), {MemRef}); @@ -2164,7 +2160,7 @@ bool NVPTXDAGToDAGISel::tryLoadParam(SDNode *Node) { Ops.push_back(Chain); Ops.push_back(Flag); - ReplaceNode(Node, CurDAG->getMachineNode(Opcode.getValue(), DL, VTs, Ops)); + ReplaceNode(Node, CurDAG->getMachineNode(*Opcode, DL, VTs, Ops)); return true; } @@ -2230,7 +2226,7 @@ bool NVPTXDAGToDAGISel::tryStoreRetval(SDNode *N) { if (!Opcode) return false; - SDNode *Ret = CurDAG->getMachineNode(Opcode.getValue(), DL, MVT::Other, Ops); + SDNode *Ret = CurDAG->getMachineNode(*Opcode, DL, MVT::Other, Ops); MachineMemOperand *MemRef = cast(N)->getMemOperand(); CurDAG->setNodeMemRefs(cast(Ret), {MemRef}); @@ -2333,8 +2329,7 @@ bool NVPTXDAGToDAGISel::tryStoreParam(SDNode *N) { } SDVTList RetVTs = CurDAG->getVTList(MVT::Other, MVT::Glue); - SDNode *Ret = - CurDAG->getMachineNode(Opcode.getValue(), DL, RetVTs, Ops); + SDNode *Ret = CurDAG->getMachineNode(*Opcode, DL, RetVTs, Ops); MachineMemOperand *MemRef = cast(N)->getMemOperand(); CurDAG->setNodeMemRefs(cast(Ret), {MemRef}); diff --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp index e7cd107..5c7f061 100644 --- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp +++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp @@ -775,7 +775,7 @@ bool PPCFastISel::SelectBranch(const Instruction *I) { if (!OptPPCPred) return false; - PPC::Predicate PPCPred = OptPPCPred.getValue(); + PPC::Predicate PPCPred = *OptPPCPred; // Take advantage of fall-through opportunities. if (FuncInfo.MBB->isLayoutSuccessor(TBB)) { diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp index e506c55..f8e3e67 100644 --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -2179,7 +2179,7 @@ bool RISCVAsmParser::parseDirectiveAttribute() { Error(TagLoc, "attribute name not recognised: " + Name); return false; } - Tag = Ret.getValue(); + Tag = *Ret; Parser.Lex(); } else { const MCExpr *AttrExpr; diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp index 3862fc8..7bafa53 100644 --- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp @@ -375,7 +375,7 @@ public: auto Type = WebAssembly::parseType(Lexer.getTok().getString()); if (!Type) return error("unknown type: ", Lexer.getTok()); - Types.push_back(Type.getValue()); + Types.push_back(*Type); Parser.Lex(); if (!isNext(AsmToken::Comma)) break; @@ -817,8 +817,7 @@ public: // Now set this symbol with the correct type. auto WasmSym = cast(Ctx.getOrCreateSymbol(SymName)); WasmSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL); - WasmSym->setGlobalType( - wasm::WasmGlobalType{uint8_t(Type.getValue()), Mutable}); + WasmSym->setGlobalType(wasm::WasmGlobalType{uint8_t(*Type), Mutable}); // And emit the directive again. TOut.emitGlobalType(WasmSym); return expect(AsmToken::EndOfStatement, "EOL"); @@ -848,7 +847,7 @@ public: // symbol auto WasmSym = cast(Ctx.getOrCreateSymbol(SymName)); WasmSym->setType(wasm::WASM_SYMBOL_TYPE_TABLE); - wasm::WasmTableType Type = {uint8_t(ElemType.getValue()), Limits}; + wasm::WasmTableType Type = {uint8_t(*ElemType), Limits}; WasmSym->setTableType(Type); TOut.emitTableType(WasmSym); return expect(AsmToken::EndOfStatement, "EOL"); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 15416c4..57d5163 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -276,7 +276,7 @@ void WebAssemblyAsmPrinter::emitSymbolType(const MCSymbolWasm *Sym) { if (!WasmTy) return; - switch (WasmTy.getValue()) { + switch (*WasmTy) { case wasm::WASM_SYMBOL_TYPE_GLOBAL: getTargetStreamer()->emitGlobalType(Sym); break; diff --git a/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp b/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp index 94d3e19..29668f4 100644 --- a/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp +++ b/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp @@ -160,7 +160,7 @@ bool X86DiscriminateMemOps::runOnMachineFunction(MachineFunction &MF) { } // Since we were able to encode, bump the MemOpDiscriminators. ++MemOpDiscriminators[L]; - DI = DI->cloneWithDiscriminator(EncodedDiscriminator.getValue()); + DI = DI->cloneWithDiscriminator(*EncodedDiscriminator); assert(DI && "DI should not be nullptr"); updateDebugInfo(&MI, DI); Changed = true; diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index bf583b7..b107de6 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -501,7 +501,7 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const { for (const MachineOperand &MO : MI->operands()) if (auto MaybeMCOp = LowerMachineOperand(MI, MO)) - OutMI.addOperand(MaybeMCOp.getValue()); + OutMI.addOperand(*MaybeMCOp); // Handle a few special cases to eliminate operand modifiers. switch (OutMI.getOpcode()) { @@ -1317,7 +1317,7 @@ void X86AsmPrinter::LowerFAULTING_OP(const MachineInstr &FaultingMI, E = FaultingMI.operands_end(); I != E; ++I) if (auto MaybeOperand = MCIL.LowerMachineOperand(&FaultingMI, *I)) - MI.addOperand(MaybeOperand.getValue()); + MI.addOperand(*MaybeOperand); OutStreamer->AddComment("on-fault: " + HandlerLabel->getName()); OutStreamer->emitInstruction(MI, getSubtargetInfo()); @@ -1382,7 +1382,7 @@ void X86AsmPrinter::LowerPATCHABLE_OP(const MachineInstr &MI, MCI.setOpcode(Opcode); for (auto &MO : drop_begin(MI.operands(), 2)) if (auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO)) - MCI.addOperand(MaybeOperand.getValue()); + MCI.addOperand(*MaybeOperand); SmallString<256> Code; SmallVector Fixups; @@ -1758,7 +1758,7 @@ void X86AsmPrinter::LowerPATCHABLE_RET(const MachineInstr &MI, Ret.setOpcode(OpCode); for (auto &MO : drop_begin(MI.operands())) if (auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO)) - Ret.addOperand(MaybeOperand.getValue()); + Ret.addOperand(*MaybeOperand); OutStreamer->emitInstruction(Ret, getSubtargetInfo()); emitX86Nops(*OutStreamer, 10, Subtarget); recordSled(CurSled, MI, SledKind::FUNCTION_EXIT, 2); @@ -1797,7 +1797,7 @@ void X86AsmPrinter::LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI, OutStreamer->AddComment("TAILCALL"); for (auto &MO : drop_begin(MI.operands())) if (auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO)) - TC.addOperand(MaybeOperand.getValue()); + TC.addOperand(*MaybeOperand); OutStreamer->emitInstruction(TC, getSubtargetInfo()); } diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index dd9f315..0613879 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1391,7 +1391,7 @@ struct AllocaUseVisitor : PtrUseVisitor { bool getShouldLiveOnFrame() const { if (!ShouldLiveOnFrame) ShouldLiveOnFrame = computeShouldLiveOnFrame(); - return ShouldLiveOnFrame.getValue(); + return *ShouldLiveOnFrame; } bool getMayWriteBeforeCoroBegin() const { return MayWriteBeforeCoroBegin; } @@ -1793,7 +1793,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) { auto *FramePtr = GetFramePointer(Alloca); auto *FramePtrRaw = Builder.CreateBitCast(FramePtr, Type::getInt8PtrTy(C)); - auto &Value = Alias.second.getValue(); + auto &Value = *Alias.second; auto ITy = IntegerType::get(C, Value.getBitWidth()); auto *AliasPtr = Builder.CreateGEP(Type::getInt8Ty(C), FramePtrRaw, ConstantInt::get(ITy, Value)); diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 9e9d262..2d8f8f2 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -2892,7 +2892,7 @@ private: KnownUBInsts.insert(I); return llvm::None; } - if (!SimplifiedV.getValue()) + if (!*SimplifiedV) return nullptr; V = *SimplifiedV; } @@ -5540,7 +5540,7 @@ struct AAValueSimplifyImpl : AAValueSimplify { A.recordDependence(AA, *this, DepClassTy::OPTIONAL); return true; } - if (auto *C = COpt.getValue()) { + if (auto *C = *COpt) { SimplifiedAssociatedValue = C; A.recordDependence(AA, *this, DepClassTy::OPTIONAL); return true; @@ -6736,7 +6736,7 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl { // Avoid arguments with padding for now. if (!getIRPosition().hasAttr(Attribute::ByVal) && - !ArgumentPromotionPass::isDenselyPacked(PrivatizableType.getValue(), + !ArgumentPromotionPass::isDenselyPacked(*PrivatizableType, A.getInfoCache().getDL())) { LLVM_DEBUG(dbgs() << "[AAPrivatizablePtr] Padding detected\n"); return indicatePessimisticFixpoint(); @@ -6745,7 +6745,7 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl { // Collect the types that will replace the privatizable type in the function // signature. SmallVector ReplacementTypes; - identifyReplacementTypes(PrivatizableType.getValue(), ReplacementTypes); + identifyReplacementTypes(*PrivatizableType, ReplacementTypes); // Verify callee and caller agree on how the promoted argument would be // passed. @@ -7061,7 +7061,7 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl { // When no alignment is specified for the load instruction, // natural alignment is assumed. createReplacementValues( - AlignAA.getAssumedAlign(), PrivatizableType.getValue(), ACS, + AlignAA.getAssumedAlign(), *PrivatizableType, ACS, ACS.getCallArgOperand(ARI.getReplacedArg().getArgNo()), NewArgOperands); }; @@ -7069,7 +7069,7 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl { // Collect the types that will replace the privatizable type in the function // signature. SmallVector ReplacementTypes; - identifyReplacementTypes(PrivatizableType.getValue(), ReplacementTypes); + identifyReplacementTypes(*PrivatizableType, ReplacementTypes); // Register a rewrite of the argument. if (A.registerFunctionSignatureRewrite(*Arg, ReplacementTypes, diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp index 82484f6..89ae575 100644 --- a/llvm/lib/Transforms/IPO/IROutliner.cpp +++ b/llvm/lib/Transforms/IPO/IROutliner.cpp @@ -777,7 +777,7 @@ static void findConstants(IRSimilarityCandidate &C, DenseSet &NotSame, for (Value *V : (*IDIt).OperVals) { // Since these are stored before any outlining, they will be in the // global value numbering. - unsigned GVN = C.getGVN(V).getValue(); + unsigned GVN = *C.getGVN(V); if (isa(V)) if (NotSame.contains(GVN) && !Seen.contains(GVN)) { Inputs.push_back(GVN); @@ -1194,7 +1194,7 @@ static Optional getGVNForPHINode(OutlinableRegion &Region, continue; // Collect the canonical numbers of the values in the PHINode. - unsigned GVN = OGVN.getValue(); + unsigned GVN = *OGVN; OGVN = Cand.getCanonicalNum(GVN); assert(OGVN && "No GVN found for incoming value?"); PHIGVNs.push_back(*OGVN); @@ -1223,7 +1223,7 @@ static Optional getGVNForPHINode(OutlinableRegion &Region, assert(PrevBlock && "Expected a predecessor not in the reigon!"); OGVN = Cand.getGVN(PrevBlock); } - GVN = OGVN.getValue(); + GVN = *OGVN; OGVN = Cand.getCanonicalNum(GVN); assert(OGVN && "No GVN found for incoming block?"); PHIGVNs.push_back(*OGVN); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index bdd5e00..3de8f08 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -975,7 +975,7 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) { Attribute Attr = Trunc.getFunction()->getFnAttribute(Attribute::VScaleRange); if (Optional MaxVScale = Attr.getVScaleRangeMax()) { - if (Log2_32(MaxVScale.getValue()) < DestWidth) { + if (Log2_32(*MaxVScale) < DestWidth) { Value *VScale = Builder.CreateVScale(ConstantInt::get(DestTy, 1)); return replaceInstUsesWith(Trunc, VScale); } @@ -1347,7 +1347,7 @@ Instruction *InstCombinerImpl::visitZExt(ZExtInst &CI) { Attribute Attr = CI.getFunction()->getFnAttribute(Attribute::VScaleRange); if (Optional MaxVScale = Attr.getVScaleRangeMax()) { unsigned TypeWidth = Src->getType()->getScalarSizeInBits(); - if (Log2_32(MaxVScale.getValue()) < TypeWidth) { + if (Log2_32(*MaxVScale) < TypeWidth) { Value *VScale = Builder.CreateVScale(ConstantInt::get(DestTy, 1)); return replaceInstUsesWith(CI, VScale); } @@ -1620,7 +1620,7 @@ Instruction *InstCombinerImpl::visitSExt(SExtInst &CI) { CI.getFunction()->hasFnAttribute(Attribute::VScaleRange)) { Attribute Attr = CI.getFunction()->getFnAttribute(Attribute::VScaleRange); if (Optional MaxVScale = Attr.getVScaleRangeMax()) { - if (Log2_32(MaxVScale.getValue()) < (SrcBitSize - 1)) { + if (Log2_32(*MaxVScale) < (SrcBitSize - 1)) { Value *VScale = Builder.CreateVScale(ConstantInt::get(DestTy, 1)); return replaceInstUsesWith(CI, VScale); } diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index 77e6af3..7843b15 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -313,8 +313,7 @@ public: auto PreheaderCount = BFI->getBlockProfileCount(L.getLoopPreheader()); // If the average loop trip count is not greater than 1.5, we skip // promotion. - if (PreheaderCount && - (PreheaderCount.getValue() * 3) >= (InstrCount.getValue() * 2)) + if (PreheaderCount && (*PreheaderCount * 3) >= (*InstrCount * 2)) continue; } diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 4dac144..3a29cd7 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -1619,7 +1619,7 @@ static void fixFuncEntryCount(PGOUseFunc &Func, LoopInfo &LI, continue; auto BFICount = NBFI.getBlockProfileCount(&BBI); CountValue = Func.getBBInfo(&BBI).CountValue; - BFICountValue = BFICount.getValue(); + BFICountValue = *BFICount; SumCount.add(APFloat(CountValue * 1.0), APFloat::rmNearestTiesToEven); SumBFICount.add(APFloat(BFICountValue * 1.0), APFloat::rmNearestTiesToEven); } @@ -1672,7 +1672,7 @@ static void verifyFuncBFI(PGOUseFunc &Func, LoopInfo &LI, NonZeroBBNum++; auto BFICount = NBFI.getBlockProfileCount(&BBI); if (BFICount) - BFICountValue = BFICount.getValue(); + BFICountValue = *BFICount; if (HotBBOnly) { bool rawIsHot = CountValue >= HotCountThreshold; diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 888ca69..31a6988 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1188,9 +1188,7 @@ bool GVNPass::AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, canCoerceMustAliasedValueToLoad(DepLoad, LoadType, DL)) { const auto ClobberOff = MD->getClobberOffset(DepLoad); // GVN has no deal with a negative offset. - Offset = (ClobberOff == None || ClobberOff.getValue() < 0) - ? -1 - : ClobberOff.getValue(); + Offset = (ClobberOff == None || *ClobberOff < 0) ? -1 : *ClobberOff; } if (Offset == -1) Offset = diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index 0005ea9..0e27c85 100644 --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -1414,7 +1414,7 @@ bool LoopConstrainer::run() { return false; } - SubRanges SR = MaybeSR.getValue(); + SubRanges SR = *MaybeSR; bool Increasing = MainLoopStructure.IndVarIncreasing; IntegerType *IVTy = cast(Range.getBegin()->getType()); @@ -1927,7 +1927,7 @@ bool InductiveRangeCheckElimination::run( << FailureReason << "\n";); return false; } - LoopStructure LS = MaybeLoopStructure.getValue(); + LoopStructure LS = *MaybeLoopStructure; if (!isProfitableToTransform(*L, LS)) return false; const SCEVAddRecExpr *IndVar = diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp index 922f13a..d0ee5b4 100644 --- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp +++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp @@ -777,7 +777,7 @@ unsigned LoopPredication::collectChecks(SmallVectorImpl &Checks, if (ICmpInst *ICI = dyn_cast(Condition)) { if (auto NewRangeCheck = widenICmpRangeCheck(ICI, Expander, Guard)) { - Checks.push_back(NewRangeCheck.getValue()); + Checks.push_back(*NewRangeCheck); NumWidened++; continue; } diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 5f23ebf..f8e0020 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -304,7 +304,7 @@ static ArrayRef GetDeoptBundleOperands(const CallBase *Call) { return None; } - return DeoptBundle.getValue().Inputs; + return DeoptBundle->Inputs; } /// Compute the live-in set for every basic block in the function diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index e789194..e6372fc 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -222,7 +222,7 @@ static bool addDiscriminators(Function &F) { << DIL->getColumn() << ":" << Discriminator << " " << I << "\n"); } else { - I.setDebugLoc(NewDIL.getValue()); + I.setDebugLoc(*NewDIL); LLVM_DEBUG(dbgs() << DIL->getFilename() << ":" << DIL->getLine() << ":" << DIL->getColumn() << ":" << Discriminator << " " << I << "\n"); @@ -260,7 +260,7 @@ static bool addDiscriminators(Function &F) { << CurrentDIL->getLine() << ":" << CurrentDIL->getColumn() << ":" << Discriminator << " " << I << "\n"); } else { - I.setDebugLoc(NewDIL.getValue()); + I.setDebugLoc(*NewDIL); Changed = true; } } diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index df14e85..b203259 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -485,7 +485,7 @@ bool llvm::wouldInstructionBeTriviallyDead(Instruction *I, if (auto *FPI = dyn_cast(I)) { Optional ExBehavior = FPI->getExceptionBehavior(); - return ExBehavior.getValue() != fp::ebStrict; + return *ExBehavior != fp::ebStrict; } } diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index 636f6448..1be1082 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -513,7 +513,7 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI, if (const DILocation *DIL = I.getDebugLoc()) { auto NewDIL = DIL->cloneByMultiplyingDuplicationFactor(ULO.Count); if (NewDIL) - I.setDebugLoc(NewDIL.getValue()); + I.setDebugLoc(*NewDIL); else LLVM_DEBUG(dbgs() << "Failed to create new discriminator: " diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp index 2f158e05..96485d1 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp @@ -356,7 +356,7 @@ llvm::UnrollAndJamLoop(Loop *L, unsigned Count, unsigned TripCount, if (const DILocation *DIL = I.getDebugLoc()) { auto NewDIL = DIL->cloneByMultiplyingDuplicationFactor(Count); if (NewDIL) - I.setDebugLoc(NewDIL.getValue()); + I.setDebugLoc(*NewDIL); else LLVM_DEBUG(dbgs() << "Failed to create new discriminator: " diff --git a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp index 0710977..142d58a 100644 --- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp +++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp @@ -144,7 +144,7 @@ void StackInfoBuilder::visit(Instruction &Inst) { uint64_t getAllocaSizeInBytes(const AllocaInst &AI) { auto DL = AI.getModule()->getDataLayout(); - return AI.getAllocationSizeInBits(DL).getValue() / 8; + return *AI.getAllocationSizeInBits(DL) / 8; } void alignAndPadAlloca(memtag::AllocaInfo &Info, llvm::Align Alignment) { diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 7b8d88a..44a8998 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -933,7 +933,7 @@ void InnerLoopVectorizer::setDebugLocFromInst( auto NewDIL = DIL->cloneByMultiplyingDuplicationFactor(UF * VF.getKnownMinValue()); if (NewDIL) - Builder.SetCurrentDebugLocation(NewDIL.getValue()); + Builder.SetCurrentDebugLocation(*NewDIL); else LLVM_DEBUG(dbgs() << "Failed to create new discriminator: " @@ -5319,7 +5319,7 @@ VectorizationFactor LoopVectorizationCostModel::selectVectorizationFactor( #ifndef NDEBUG unsigned AssumedMinimumVscale = 1; if (Optional VScale = getVScaleForTuning()) - AssumedMinimumVscale = VScale.getValue(); + AssumedMinimumVscale = *VScale; unsigned Width = Candidate.Width.isScalable() ? Candidate.Width.getKnownMinValue() * AssumedMinimumVscale @@ -5537,7 +5537,7 @@ LoopVectorizationCostModel::selectEpilogueVectorizationFactor( if (MainLoopVF.isScalable()) { EstimatedRuntimeVF = ElementCount::getFixed(MainLoopVF.getKnownMinValue()); if (Optional VScale = getVScaleForTuning()) - EstimatedRuntimeVF *= VScale.getValue(); + EstimatedRuntimeVF *= *VScale; } for (auto &NextVF : ProfitableVFs) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index ba930c4..77bc612 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1597,7 +1597,7 @@ public: } if (BestOp.Idx) { - getData(BestOp.Idx.getValue(), Lane).IsUsed = IsUsed; + getData(*BestOp.Idx, Lane).IsUsed = IsUsed; return BestOp.Idx; } // If we could not find a good match return None. @@ -1938,7 +1938,7 @@ public: if (BestIdx) { // Swap the current operand with the one returned by // getBestOperand(). - swap(OpIdx, BestIdx.getValue(), Lane); + swap(OpIdx, *BestIdx, Lane); } else { // We failed to find a best operand, set mode to 'Failed'. ReorderingModes[OpIdx] = ReorderingMode::Failed; @@ -2557,7 +2557,7 @@ private: ScalarToTreeEntry[V] = Last; } // Update the scheduler bundle to point to this TreeEntry. - ScheduleData *BundleMember = Bundle.getValue(); + ScheduleData *BundleMember = *Bundle; assert((BundleMember || isa(S.MainOp) || isVectorLikeInstWithConstOps(S.MainOp) || doesNotNeedToSchedule(VL)) && diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp index 07e32ee..3a7e77f 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp @@ -387,7 +387,7 @@ VPInstruction *VPlanSlp::buildGraph(ArrayRef Values) { return markFailed(); assert(getOpcode(Values) && "Opcodes for all values must match"); - unsigned ValuesOpcode = getOpcode(Values).getValue(); + unsigned ValuesOpcode = *getOpcode(Values); SmallVector CombinedOperands; if (areCommutative(Values)) { diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp index a70b97b..f38eb00 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -538,7 +538,7 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L, auto Highlight = [&](const std::string &Snippet, unsigned LC, unsigned RC) { if (getOptions().Debug) HighlightedRanges.emplace_back(LC, RC); - return tag("span", Snippet, std::string(Color.getValue())); + return tag("span", Snippet, std::string(*Color)); }; auto CheckIfUncovered = [&](const CoverageSegment *S) { diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp index b102604..f9b6a8c 100644 --- a/llvm/tools/llvm-ifs/llvm-ifs.cpp +++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp @@ -519,7 +519,7 @@ int main(int argc, char *argv[]) { // TODO: Remove OutputFormat flag in the next revision. WithColor::warning() << "--output-format option is deprecated, please use " "--output-{FILE_FORMAT} options instead\n"; - switch (Config.OutputFormat.getValue()) { + switch (*Config.OutputFormat) { case FileFormat::TBD: { std::error_code SysErr; raw_fd_ostream Out(*Config.Output, SysErr); diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index 79dd175..c826661 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -1066,7 +1066,7 @@ int main(int argc, char **argv) { CodeGen.setAttrs(codegen::getMAttrs()); if (auto FT = codegen::getExplicitFileType()) - CodeGen.setFileType(FT.getValue()); + CodeGen.setFileType(*FT); if (!OutputFilename.empty()) { if (SaveLinkedModuleFile) { diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp index b9abc4c..d0e54cdec 100644 --- a/llvm/tools/llvm-lto2/llvm-lto2.cpp +++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp @@ -241,7 +241,7 @@ static int run(int argc, char **argv) { Conf.Options = codegen::InitTargetOptionsFromCodeGenFlags(Triple()); Conf.MAttrs = codegen::getMAttrs(); if (auto RM = codegen::getExplicitRelocModel()) - Conf.RelocModel = RM.getValue(); + Conf.RelocModel = *RM; Conf.CodeModel = codegen::getExplicitCodeModel(); Conf.DebugPassManager = DebugPassManager; @@ -288,7 +288,7 @@ static int run(int argc, char **argv) { } if (auto FT = codegen::getExplicitFileType()) - Conf.CGFileType = FT.getValue(); + Conf.CGFileType = *FT; Conf.OverrideTriple = OverrideTriple; Conf.DefaultTriple = DefaultTriple; diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 0fc09131..42c3820 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2129,7 +2129,7 @@ void objdump::printSymbol(const ObjectFile *O, const SymbolRef &Symbol, dyn_cast(O), Symbol); if (SymRef) { - Expected NameOrErr = SymRef.getValue().getName(); + Expected NameOrErr = SymRef->getName(); if (NameOrErr) { outs() << " (csect:"; @@ -2289,7 +2289,7 @@ static void printFaultMaps(const ObjectFile *Obj) { } StringRef FaultMapContents = - unwrapOrError(FaultMapSection.getValue().getContents(), Obj->getFileName()); + unwrapOrError(FaultMapSection->getContents(), Obj->getFileName()); FaultMapParser FMP(FaultMapContents.bytes_begin(), FaultMapContents.bytes_end()); diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp index 50e32ea..c0c23ea 100644 --- a/llvm/tools/obj2yaml/dwarf2yaml.cpp +++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp @@ -450,9 +450,7 @@ void dumpDebugLines(DWARFContext &DCtx, DWARFYAML::Data &Y) { default: for (uint8_t i = 0; - i < - DebugLines.StandardOpcodeLengths.getValue()[NewOp.Opcode - 1]; - ++i) + i < (*DebugLines.StandardOpcodeLengths)[NewOp.Opcode - 1]; ++i) NewOp.StandardOpcodeData.push_back(LineData.getULEB128(&Offset)); } } -- 2.7.4