diff options
author | Nikita Popov <npopov@redhat.com> | 2023-10-16 12:45:48 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-10-16 13:00:31 +0200 |
commit | b5743d4798b250506965e07ebab806a3c2d767cc (patch) | |
tree | fc5c0c36b95f03fe00ed3a295c43e6aad9dfec89 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 3b23704f161c3dd89d4a0b637c9008f573cb87c8 (diff) | |
download | llvm-b5743d4798b250506965e07ebab806a3c2d767cc.zip llvm-b5743d4798b250506965e07ebab806a3c2d767cc.tar.gz llvm-b5743d4798b250506965e07ebab806a3c2d767cc.tar.bz2 |
[ValueTracking] Remove by-ref computeKnownBits() overloads (NFC)
Remove the old overloads that accept KnownBits by reference, in
favor of those that return it by value.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 8231044..18a2562 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -159,25 +159,6 @@ static void computeKnownBits(const Value *V, KnownBits &Known, unsigned Depth, computeKnownBits(V, DemandedElts, Known, Depth, Q); } -void llvm::computeKnownBits(const Value *V, KnownBits &Known, - const DataLayout &DL, unsigned Depth, - AssumptionCache *AC, const Instruction *CxtI, - const DominatorTree *DT, bool UseInstrInfo) { - ::computeKnownBits( - V, Known, Depth, - SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo)); -} - -void llvm::computeKnownBits(const Value *V, const APInt &DemandedElts, - KnownBits &Known, const DataLayout &DL, - unsigned Depth, AssumptionCache *AC, - const Instruction *CxtI, const DominatorTree *DT, - bool UseInstrInfo) { - ::computeKnownBits( - V, DemandedElts, Known, Depth, - SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo)); -} - static KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts, unsigned Depth, const SimplifyQuery &Q); @@ -250,11 +231,9 @@ bool llvm::haveNoCommonBitsSet(const Value *LHS, const Value *RHS, match(LHS, m_Not(m_c_Or(m_Specific(A), m_Specific(B))))) return true; } - IntegerType *IT = cast<IntegerType>(LHS->getType()->getScalarType()); - KnownBits LHSKnown(IT->getBitWidth()); - KnownBits RHSKnown(IT->getBitWidth()); - ::computeKnownBits(LHS, LHSKnown, 0, SQ); - ::computeKnownBits(RHS, RHSKnown, 0, SQ); + + KnownBits LHSKnown = ::computeKnownBits(LHS, 0, SQ); + KnownBits RHSKnown = ::computeKnownBits(RHS, 0, SQ); return KnownBits::haveNoCommonBitsSet(LHSKnown, RHSKnown); } @@ -8140,9 +8119,8 @@ static bool isTruePredicate(CmpInst::Predicate Pred, const Value *LHS, // If X & C == 0 then (X | C) == X +_{nuw} C if (match(A, m_Or(m_Value(X), m_APInt(CA))) && match(B, m_Or(m_Specific(X), m_APInt(CB)))) { - KnownBits Known(CA->getBitWidth()); - computeKnownBits(X, Known, DL, Depth + 1, /*AC*/ nullptr, - /*CxtI*/ nullptr, /*DT*/ nullptr); + KnownBits Known = computeKnownBits(X, DL, Depth + 1, /*AC*/ nullptr, + /*CxtI*/ nullptr, /*DT*/ nullptr); if (CA->isSubsetOf(Known.Zero) && CB->isSubsetOf(Known.Zero)) return true; } |