aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-06-03 17:12:24 +0100
committerGitHub <noreply@github.com>2025-06-03 17:12:24 +0100
commitb40e4ceaa61c5f14ca261e2952e7f85a066403e2 (patch)
tree22a01d10255678e3a57fae6fc962c3325bbebd00 /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
parentcb4a407e5c2a8a5972781d2a3be362f437602fae (diff)
downloadllvm-b40e4ceaa61c5f14ca261e2952e7f85a066403e2.zip
llvm-b40e4ceaa61c5f14ca261e2952e7f85a066403e2.tar.gz
llvm-b40e4ceaa61c5f14ca261e2952e7f85a066403e2.tar.bz2
[ValueTracking] Make Depth last default arg (NFC) (#142384)
Having a finite Depth (or recursion limit) for computeKnownBits is very limiting, but is currently a load-bearing necessity, as all KnownBits are recomputed on each call and there is no caching. As a prerequisite for an effort to remove the recursion limit altogether, either using a clever caching technique, or writing a easily-invalidable KnownBits analysis, make the Depth argument in APIs in ValueTracking uniformly the last argument with a default value. This would aid in removing the argument when the time comes, as many callers that currently pass 0 explicitly are now updated to omit the argument altogether.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 94a79ad..737321d 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1001,7 +1001,7 @@ Value *LibCallSimplifier::optimizeStringLength(CallInst *CI, IRBuilderBase &B,
}
Value *Offset = GEP->getOperand(2);
- KnownBits Known = computeKnownBits(Offset, DL, 0, nullptr, CI, nullptr);
+ KnownBits Known = computeKnownBits(Offset, DL, nullptr, CI, nullptr);
uint64_t ArrSize =
cast<ArrayType>(GEP->getSourceElementType())->getNumElements();
@@ -2262,7 +2262,7 @@ Value *LibCallSimplifier::replacePowWithSqrt(CallInst *Pow, IRBuilderBase &B) {
// errno), but sqrt(-Inf) is required by various standards to set errno.
if (!Pow->doesNotAccessMemory() && !Pow->hasNoInfs() &&
!isKnownNeverInfinity(
- Base, 0, SimplifyQuery(DL, TLI, DT, AC, Pow, true, true, DC)))
+ Base, SimplifyQuery(DL, TLI, DT, AC, Pow, true, true, DC)))
return nullptr;
Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), Mod, B,
@@ -2574,8 +2574,7 @@ Value *LibCallSimplifier::optimizeLog(CallInst *Log, IRBuilderBase &B) {
SimplifyQuery SQ(DL, TLI, DT, AC, Log, true, true, DC);
KnownFPClass Known = computeKnownFPClass(
Log->getOperand(0),
- KnownFPClass::OrderedLessThanZeroMask | fcSubnormal,
- /*Depth=*/0, SQ);
+ KnownFPClass::OrderedLessThanZeroMask | fcSubnormal, SQ);
Function *F = Log->getParent()->getParent();
const fltSemantics &FltSem = Ty->getScalarType()->getFltSemantics();
IsKnownNoErrno =
@@ -2803,12 +2802,10 @@ Value *LibCallSimplifier::optimizeFMod(CallInst *CI, IRBuilderBase &B) {
bool IsNoNan = CI->hasNoNaNs();
if (!IsNoNan) {
SimplifyQuery SQ(DL, TLI, DT, AC, CI, true, true, DC);
- KnownFPClass Known0 = computeKnownFPClass(CI->getOperand(0), fcInf,
- /*Depth=*/0, SQ);
+ KnownFPClass Known0 = computeKnownFPClass(CI->getOperand(0), fcInf, SQ);
if (Known0.isKnownNeverInfinity()) {
KnownFPClass Known1 =
- computeKnownFPClass(CI->getOperand(1), fcZero | fcSubnormal,
- /*Depth=*/0, SQ);
+ computeKnownFPClass(CI->getOperand(1), fcZero | fcSubnormal, SQ);
Function *F = CI->getParent()->getParent();
const fltSemantics &FltSem =
CI->getType()->getScalarType()->getFltSemantics();