aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-02 20:05:20 -0800
committerKazu Hirata <kazu@google.com>2022-12-02 20:05:20 -0800
commite842c06c2d52ae1d60db7ed528ea3f4215a0aad6 (patch)
tree2fa4d17e05b9dec6d22fddb83293ebb43b0dfc7d /llvm/lib/IR/ConstantFold.cpp
parent19aff0f37dd68ee51e78b764c0ce629ae73d1eef (diff)
downloadllvm-e842c06c2d52ae1d60db7ed528ea3f4215a0aad6.zip
llvm-e842c06c2d52ae1d60db7ed528ea3f4215a0aad6.tar.gz
llvm-e842c06c2d52ae1d60db7ed528ea3f4215a0aad6.tar.bz2
[IR] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. 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
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 74b7d19..1815bba 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1073,7 +1073,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
} else if (isa<Function>(GV)) {
// Without a datalayout we have to assume the worst case: that the
// function pointer isn't aligned at all.
- GVAlign = llvm::None;
+ GVAlign = std::nullopt;
} else if (isa<GlobalVariable>(GV)) {
GVAlign = cast<GlobalVariable>(GV)->getAlign();
}
@@ -2024,7 +2024,7 @@ static Constant *foldGEPOfGEP(GEPOperator *GEP, Type *PointeeTy, bool InBounds,
// outer GEP, any inbounds attribute on that index is invalidated.
Optional<unsigned> IRIndex = GEP->getInRangeIndex();
if (IRIndex && *IRIndex == GEP->getNumIndices() - 1)
- IRIndex = None;
+ IRIndex = std::nullopt;
return ConstantExpr::getGetElementPtr(
GEP->getSourceElementType(), cast<Constant>(GEP->getPointerOperand()),