aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp
index 7509fde6df9d..dc58bebd724b 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp
+++ b/contrib/llvm-project/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