Skip to content

Commit 15b683a

Browse files
committed
Make non-broken
1 parent c72d7a5 commit 15b683a

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

llvm/include/llvm/Analysis/CachedBitsValue.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919
#include "llvm/Support/KnownBits.h"
2020
#include <type_traits>
2121

22-
namespace llvm {
2322

24-
class DataLayout;
25-
class AssumptionCache;
26-
class Instruction;
27-
class DominatorTree;
28-
struct SimplifyQuery;
23+
namespace llvm {
24+
struct SimplifyQuery;
25+
}
2926

30-
KnownBits computeKnownBits(const Value *V, unsigned Depth,
31-
const SimplifyQuery &Q);
27+
llvm::KnownBits computeKnownBits(const llvm::Value *V, unsigned Depth,
28+
const llvm::SimplifyQuery &Q);
3229

30+
namespace llvm {
3331
namespace detail {
3432
/// Represents a pointer to an llvm::Value with known bits information
3533
template <bool ConstPointer = true> class ImplCachedBitsValue {

llvm/include/llvm/Analysis/ValueTracking.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
9191
const DominatorTree *DT = nullptr,
9292
bool UseInstrInfo = true);
9393

94-
KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
95-
unsigned Depth, const SimplifyQuery &Q);
94+
// KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
95+
// unsigned Depth, const SimplifyQuery &Q);
9696

97-
KnownBits computeKnownBits(const Value *V, unsigned Depth,
98-
const SimplifyQuery &Q);
97+
// KnownBits computeKnownBits(const Value *V, unsigned Depth,
98+
// const SimplifyQuery &Q);
9999

100100
/// Compute known bits from the range metadata.
101101
/// \p KnownZero the set of bits that are known to be zero

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,25 @@ void llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
179179
SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo));
180180
}
181181

182+
KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
183+
unsigned Depth, const SimplifyQuery &Q);
184+
185+
KnownBits computeKnownBits(const Value *V, unsigned Depth,
186+
const SimplifyQuery &Q);
187+
182188
KnownBits llvm::computeKnownBits(const Value *V, const DataLayout &DL,
183189
unsigned Depth, AssumptionCache *AC,
184190
const Instruction *CxtI,
185191
const DominatorTree *DT, bool UseInstrInfo) {
186-
return computeKnownBits(
192+
return ::computeKnownBits(
187193
V, Depth, SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo));
188194
}
189195

190196
KnownBits llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
191197
const DataLayout &DL, unsigned Depth,
192198
AssumptionCache *AC, const Instruction *CxtI,
193199
const DominatorTree *DT, bool UseInstrInfo) {
194-
return computeKnownBits(
200+
return ::computeKnownBits(
195201
V, DemandedElts, Depth,
196202
SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo));
197203
}
@@ -1781,19 +1787,19 @@ static void computeKnownBitsFromOperator(const Operator *I,
17811787

17821788
/// Determine which bits of V are known to be either zero or one and return
17831789
/// them.
1784-
KnownBits llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
1790+
KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
17851791
unsigned Depth, const SimplifyQuery &Q) {
17861792
KnownBits Known(getBitWidth(V->getType(), Q.DL));
1787-
::computeKnownBits(V, DemandedElts, Known, Depth, Q);
1793+
computeKnownBits(V, DemandedElts, Known, Depth, Q);
17881794
return Known;
17891795
}
17901796

17911797
/// Determine which bits of V are known to be either zero or one and return
17921798
/// them.
1793-
KnownBits llvm::computeKnownBits(const Value *V, unsigned Depth,
1799+
KnownBits computeKnownBits(const Value *V, unsigned Depth,
17941800
const SimplifyQuery &Q) {
17951801
KnownBits Known(getBitWidth(V->getType(), Q.DL));
1796-
::computeKnownBits(V, Known, Depth, Q);
1802+
computeKnownBits(V, Known, Depth, Q);
17971803
return Known;
17981804
}
17991805

llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,8 +1567,7 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
15671567

15681568
// A+B --> A|B iff A and B have no bits set in common.
15691569
CachedBitsConstValue LHSCache(LHS), RHSCache(RHS);
1570-
if (haveNoCommonBitsSet(LHSCache, RHSCache, SQ.getWithInstruction(&I),
1571-
/* ComputeKnownBitsBeforeHand */ true))
1570+
if (haveNoCommonBitsSet(LHSCache, RHSCache, SQ.getWithInstruction(&I)))
15721571
return BinaryOperator::CreateOr(LHS, RHS);
15731572

15741573
if (Instruction *Ext = narrowMathIfNoOverflow(I))

0 commit comments

Comments
 (0)