diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 9ada3a2d..0e4576f 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -247,7 +247,7 @@ void llvm::addStringMetadataToLoop(Loop *TheLoop, const char *StringMD, TheLoop->setLoopID(NewLoopID); } -Optional<ElementCount> +std::optional<ElementCount> llvm::getOptionalElementCountLoopAttribute(const Loop *TheLoop) { std::optional<int> Width = getOptionalIntLoopAttribute(TheLoop, "llvm.loop.vectorize.width"); @@ -261,7 +261,7 @@ llvm::getOptionalElementCountLoopAttribute(const Loop *TheLoop) { return std::nullopt; } -Optional<MDNode *> llvm::makeFollowupLoopID( +std::optional<MDNode *> llvm::makeFollowupLoopID( MDNode *OrigLoopID, ArrayRef<StringRef> FollowupOptions, const char *InheritOptionsExceptPrefix, bool AlwaysNew) { if (!OrigLoopID) { @@ -396,7 +396,7 @@ TransformationMode llvm::hasVectorizeTransformation(const Loop *L) { if (Enable == false) return TM_SuppressedByUser; - Optional<ElementCount> VectorizeWidth = + std::optional<ElementCount> VectorizeWidth = getOptionalElementCountLoopAttribute(L); std::optional<int> InterleaveCount = getOptionalIntLoopAttribute(L, "llvm.loop.interleave.count"); @@ -782,9 +782,9 @@ static BranchInst *getExpectedExitLoopLatchBranch(Loop *L) { /// Return the estimated trip count for any exiting branch which dominates /// the loop latch. -static Optional<uint64_t> -getEstimatedTripCount(BranchInst *ExitingBranch, Loop *L, - uint64_t &OrigExitWeight) { +static std::optional<uint64_t> getEstimatedTripCount(BranchInst *ExitingBranch, + Loop *L, + uint64_t &OrigExitWeight) { // To estimate the number of times the loop body was executed, we want to // know the number of times the backedge was taken, vs. the number of times // we exited the loop. @@ -808,7 +808,7 @@ getEstimatedTripCount(BranchInst *ExitingBranch, Loop *L, return ExitCount + 1; } -Optional<unsigned> +std::optional<unsigned> llvm::getLoopEstimatedTripCount(Loop *L, unsigned *EstimatedLoopInvocationWeight) { // Currently we take the estimate exit count only from the loop latch, @@ -817,8 +817,8 @@ llvm::getLoopEstimatedTripCount(Loop *L, // TODO: incorporate information from other exits if (BranchInst *LatchBranch = getExpectedExitLoopLatchBranch(L)) { uint64_t ExitWeight; - if (Optional<uint64_t> EstTripCount = - getEstimatedTripCount(LatchBranch, L, ExitWeight)) { + if (std::optional<uint64_t> EstTripCount = + getEstimatedTripCount(LatchBranch, L, ExitWeight)) { if (EstimatedLoopInvocationWeight) *EstimatedLoopInvocationWeight = ExitWeight; return *EstTripCount; @@ -1477,7 +1477,7 @@ void llvm::setProfileInfoAfterUnrolling(Loop *OrigLoop, Loop *UnrolledLoop, // Get number of iterations in the original scalar loop. unsigned OrigLoopInvocationWeight = 0; - Optional<unsigned> OrigAverageTripCount = + std::optional<unsigned> OrigAverageTripCount = getLoopEstimatedTripCount(OrigLoop, &OrigLoopInvocationWeight); if (!OrigAverageTripCount) return; @@ -1704,10 +1704,9 @@ Value *llvm::addDiffRuntimeChecks( return MemoryRuntimeCheck; } -Optional<IVConditionInfo> llvm::hasPartialIVCondition(const Loop &L, - unsigned MSSAThreshold, - const MemorySSA &MSSA, - AAResults &AA) { +std::optional<IVConditionInfo> +llvm::hasPartialIVCondition(const Loop &L, unsigned MSSAThreshold, + const MemorySSA &MSSA, AAResults &AA) { auto *TI = dyn_cast<BranchInst>(L.getHeader()->getTerminator()); if (!TI || !TI->isConditional()) return {}; @@ -1764,7 +1763,7 @@ Optional<IVConditionInfo> llvm::hasPartialIVCondition(const Loop &L, [&L, &AA, &AccessedLocs, &ExitingBlocks, &InstToDuplicate, MSSAThreshold](BasicBlock *Succ, BasicBlock *Header, SmallVector<MemoryAccess *, 4> AccessesToCheck) - -> Optional<IVConditionInfo> { + -> std::optional<IVConditionInfo> { IVConditionInfo Info; // First, collect all blocks in the loop that are on a patch from Succ // to the header. |