aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-02 21:11:37 -0800
committerKazu Hirata <kazu@google.com>2022-12-02 21:11:37 -0800
commit343de6856e16b58bcbd16d479fc633f54e22fadc (patch)
tree31e3fbef03aa0e4c5ea9582d0eacc650aba3073d /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
parent998960ee1f2c8bc3830df4849ab89ec9d6217f26 (diff)
downloadllvm-343de6856e16b58bcbd16d479fc633f54e22fadc.zip
llvm-343de6856e16b58bcbd16d479fc633f54e22fadc.tar.gz
llvm-343de6856e16b58bcbd16d479fc633f54e22fadc.tar.bz2
[Transforms] 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/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 9b5d0b8f..061ddd7 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -3855,7 +3855,7 @@ Value *FortifiedLibCallSimplifier::optimizeStrpCpyChk(CallInst *CI,
// st[rp]cpy_chk call which may fail at runtime if the size is too long.
// TODO: It might be nice to get a maximum length out of the possible
// string lengths for varying.
- if (isFortifiedCallFoldable(CI, 2, None, 1)) {
+ if (isFortifiedCallFoldable(CI, 2, std::nullopt, 1)) {
if (Func == LibFunc_strcpy_chk)
return copyFlags(*CI, emitStrCpy(Dst, Src, B, TLI));
else
@@ -3886,7 +3886,7 @@ Value *FortifiedLibCallSimplifier::optimizeStrpCpyChk(CallInst *CI,
Value *FortifiedLibCallSimplifier::optimizeStrLenChk(CallInst *CI,
IRBuilderBase &B) {
- if (isFortifiedCallFoldable(CI, 1, None, 0))
+ if (isFortifiedCallFoldable(CI, 1, std::nullopt, 0))
return copyFlags(*CI, emitStrLen(CI->getArgOperand(0), B,
CI->getModule()->getDataLayout(), TLI));
return nullptr;
@@ -3921,7 +3921,7 @@ Value *FortifiedLibCallSimplifier::optimizeMemCCpyChk(CallInst *CI,
Value *FortifiedLibCallSimplifier::optimizeSNPrintfChk(CallInst *CI,
IRBuilderBase &B) {
- if (isFortifiedCallFoldable(CI, 3, 1, None, 2)) {
+ if (isFortifiedCallFoldable(CI, 3, 1, std::nullopt, 2)) {
SmallVector<Value *, 8> VariadicArgs(drop_begin(CI->args(), 5));
return copyFlags(*CI,
emitSNPrintf(CI->getArgOperand(0), CI->getArgOperand(1),
@@ -3933,7 +3933,7 @@ Value *FortifiedLibCallSimplifier::optimizeSNPrintfChk(CallInst *CI,
Value *FortifiedLibCallSimplifier::optimizeSPrintfChk(CallInst *CI,
IRBuilderBase &B) {
- if (isFortifiedCallFoldable(CI, 2, None, None, 1)) {
+ if (isFortifiedCallFoldable(CI, 2, std::nullopt, std::nullopt, 1)) {
SmallVector<Value *, 8> VariadicArgs(drop_begin(CI->args(), 4));
return copyFlags(*CI,
emitSPrintf(CI->getArgOperand(0), CI->getArgOperand(3),
@@ -3984,7 +3984,7 @@ Value *FortifiedLibCallSimplifier::optimizeStrLCpyChk(CallInst *CI,
Value *FortifiedLibCallSimplifier::optimizeVSNPrintfChk(CallInst *CI,
IRBuilderBase &B) {
- if (isFortifiedCallFoldable(CI, 3, 1, None, 2))
+ if (isFortifiedCallFoldable(CI, 3, 1, std::nullopt, 2))
return copyFlags(
*CI, emitVSNPrintf(CI->getArgOperand(0), CI->getArgOperand(1),
CI->getArgOperand(4), CI->getArgOperand(5), B, TLI));
@@ -3994,7 +3994,7 @@ Value *FortifiedLibCallSimplifier::optimizeVSNPrintfChk(CallInst *CI,
Value *FortifiedLibCallSimplifier::optimizeVSPrintfChk(CallInst *CI,
IRBuilderBase &B) {
- if (isFortifiedCallFoldable(CI, 2, None, None, 1))
+ if (isFortifiedCallFoldable(CI, 2, std::nullopt, std::nullopt, 1))
return copyFlags(*CI,
emitVSPrintf(CI->getArgOperand(0), CI->getArgOperand(3),
CI->getArgOperand(4), B, TLI));