[llvm] 1d74b24 - [Analysis] Use std::optional in BasicAliasAnalysis.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 10:11:48 PST 2022
Author: Kazu Hirata
Date: 2022-11-25T10:11:42-08:00
New Revision: 1d74b2474345b1077cb2c86dc9ccc6901f957d75
URL: https://github.com/llvm/llvm-project/commit/1d74b2474345b1077cb2c86dc9ccc6901f957d75
DIFF: https://github.com/llvm/llvm-project/commit/1d74b2474345b1077cb2c86dc9ccc6901f957d75.diff
LOG: [Analysis] Use std::optional in BasicAliasAnalysis.cpp (NFC)
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
Added:
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 537d0c44ffc9b..bf50b50eb5f49 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -58,6 +58,7 @@
#include <cassert>
#include <cstdint>
#include <cstdlib>
+#include <optional>
#include <utility>
#define DEBUG_TYPE "basicaa"
@@ -484,7 +485,7 @@ struct BasicAAResult::DecomposedGEP {
SmallVector<VariableGEPIndex, 4> VarIndices;
// Are all operations inbounds GEPs or non-indexing operations?
// (None iff expression doesn't involve any geps)
- Optional<bool> InBounds;
+ std::optional<bool> InBounds;
void dump() const {
print(dbgs());
@@ -1182,7 +1183,7 @@ AliasResult BasicAAResult::aliasGEP(
// Try to determine the range of values for VarIndex such that
// VarIndex <= -MinAbsVarIndex || MinAbsVarIndex <= VarIndex.
- Optional<APInt> MinAbsVarIndex;
+ std::optional<APInt> MinAbsVarIndex;
if (DecompGEP1.VarIndices.size() == 1) {
// VarIndex = Scale*V.
const VariableGEPIndex &Var = DecompGEP1.VarIndices[0];
@@ -1306,7 +1307,7 @@ AliasResult BasicAAResult::aliasPHI(const PHINode *PN, LocationSize PNSize,
// on corresponding edges.
if (const PHINode *PN2 = dyn_cast<PHINode>(V2))
if (PN2->getParent() == PN->getParent()) {
- Optional<AliasResult> Alias;
+ std::optional<AliasResult> Alias;
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
AliasResult ThisAlias = AAQI.AAR.alias(
MemoryLocation(PN->getIncomingValue(i), PNSize),
More information about the llvm-commits
mailing list