Skip to content

Commit

Permalink
[Analysis] Use std::optional in CFLAndersAliasAnalysis.cpp (NFC)
Browse files Browse the repository at this point in the history
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
  • Loading branch information
kazutakahirata committed Nov 25, 2022
1 parent 1d74b24 commit e51b18f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
Expand Up @@ -81,6 +81,7 @@
#include <cstddef>
#include <cstdint>
#include <functional>
#include <optional>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -351,12 +352,12 @@ static bool hasWriteOnlyState(StateSet Set) {
return (Set & StateSet(WriteOnlyStateMask)).any();
}

static Optional<InterfaceValue>
static std::optional<InterfaceValue>
getInterfaceValue(InstantiatedValue IValue,
const SmallVectorImpl<Value *> &RetVals) {
auto Val = IValue.Val;

Optional<unsigned> Index;
std::optional<unsigned> Index;
if (auto Arg = dyn_cast<Argument>(Val))
Index = Arg->getArgNo() + 1;
else if (is_contained(RetVals, Val))
Expand Down Expand Up @@ -625,7 +626,7 @@ static void initializeWorkList(std::vector<WorkListItem> &WorkList,
}
}

static Optional<InstantiatedValue> getNodeBelow(const CFLGraph &Graph,
static std::optional<InstantiatedValue> getNodeBelow(const CFLGraph &Graph,
InstantiatedValue V) {
auto NodeBelow = InstantiatedValue{V.Val, V.DerefLevel + 1};
if (Graph.getNode(NodeBelow))
Expand Down

0 comments on commit e51b18f

Please sign in to comment.