diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/Transforms/Utils/Evaluator.cpp | |
parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) |
Diffstat (limited to 'llvm/lib/Transforms/Utils/Evaluator.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Evaluator.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/Evaluator.cpp b/llvm/lib/Transforms/Utils/Evaluator.cpp index 7509fde6df9d..dc58bebd724b 100644 --- a/llvm/lib/Transforms/Utils/Evaluator.cpp +++ b/llvm/lib/Transforms/Utils/Evaluator.cpp @@ -132,7 +132,7 @@ Constant *Evaluator::MutableValue::read(Type *Ty, APInt Offset, const MutableValue *V = this; while (const auto *Agg = V->Val.dyn_cast<MutableAggregate *>()) { Type *AggTy = Agg->Ty; - Optional<APInt> Index = DL.getGEPIndexForOffset(AggTy, Offset); + std::optional<APInt> Index = DL.getGEPIndexForOffset(AggTy, Offset); if (!Index || Index->uge(Agg->Elements.size()) || !TypeSize::isKnownLE(TySize, DL.getTypeStoreSize(AggTy))) return nullptr; @@ -176,7 +176,7 @@ bool Evaluator::MutableValue::write(Constant *V, APInt Offset, MutableAggregate *Agg = MV->Val.get<MutableAggregate *>(); Type *AggTy = Agg->Ty; - Optional<APInt> Index = DL.getGEPIndexForOffset(AggTy, Offset); + std::optional<APInt> Index = DL.getGEPIndexForOffset(AggTy, Offset); if (!Index || Index->uge(Agg->Elements.size()) || !TypeSize::isKnownLE(TySize, DL.getTypeStoreSize(AggTy))) return false; @@ -626,10 +626,8 @@ bool Evaluator::EvaluateFunction(Function *F, Constant *&RetVal, CallStack.push_back(F); // Initialize arguments to the incoming values specified. - unsigned ArgNo = 0; - for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; - ++AI, ++ArgNo) - setVal(&*AI, ActualArgs[ArgNo]); + for (const auto &[ArgNo, Arg] : llvm::enumerate(F->args())) + setVal(&Arg, ActualArgs[ArgNo]); // ExecutedBlocks - We only handle non-looping, non-recursive code. As such, // we can only evaluate any one basic block at most once. This set keeps |