diff options
author | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2024-10-28 09:45:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-28 09:45:03 -0700 |
commit | 6ab26eab4f1e06f2da7b3183c55666ad57f8866e (patch) | |
tree | 8d58cecc95cfea7a335f12e325e952263cb3db3e /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | |
parent | 92412c106f5275b4b385f7c2d882008181de2854 (diff) | |
download | llvm-6ab26eab4f1e06f2da7b3183c55666ad57f8866e.zip llvm-6ab26eab4f1e06f2da7b3183c55666ad57f8866e.tar.gz llvm-6ab26eab4f1e06f2da7b3183c55666ad57f8866e.tar.bz2 |
Check hasOptSize() in shouldOptimizeForSize() (#112626)
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 79e91ad..d85e0d99 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1413,8 +1413,7 @@ Value *LibCallSimplifier::optimizeMemChr(CallInst *CI, IRBuilderBase &B) { return nullptr; } - bool OptForSize = CI->getFunction()->hasOptSize() || - llvm::shouldOptimizeForSize(CI->getParent(), PSI, BFI, + bool OptForSize = llvm::shouldOptimizeForSize(CI->getParent(), PSI, BFI, PGSOQueryType::IRPass); // If the char is variable but the input str and length are not we can turn @@ -3482,10 +3481,8 @@ Value *LibCallSimplifier::optimizeSPrintFString(CallInst *CI, return B.CreateIntCast(PtrDiff, CI->getType(), false); } - bool OptForSize = CI->getFunction()->hasOptSize() || - llvm::shouldOptimizeForSize(CI->getParent(), PSI, BFI, - PGSOQueryType::IRPass); - if (OptForSize) + if (llvm::shouldOptimizeForSize(CI->getParent(), PSI, BFI, + PGSOQueryType::IRPass)) return nullptr; Value *Len = emitStrLen(CI->getArgOperand(2), B, DL, TLI); @@ -3795,10 +3792,8 @@ Value *LibCallSimplifier::optimizeFPuts(CallInst *CI, IRBuilderBase &B) { // Don't rewrite fputs to fwrite when optimising for size because fwrite // requires more arguments and thus extra MOVs are required. - bool OptForSize = CI->getFunction()->hasOptSize() || - llvm::shouldOptimizeForSize(CI->getParent(), PSI, BFI, - PGSOQueryType::IRPass); - if (OptForSize) + if (llvm::shouldOptimizeForSize(CI->getParent(), PSI, BFI, + PGSOQueryType::IRPass)) return nullptr; // We can't optimize if return value is used. |