Skip to content

Commit 7293e8b

Browse files
committed
Make computeKnownBitsFromICmpCond part of the public API.
1 parent 30251cf commit 7293e8b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

llvm/include/llvm/Analysis/ValueTracking.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ LLVM_ABI void computeKnownBitsFromContext(const Value *V, KnownBits &Known,
102102
const SimplifyQuery &Q,
103103
unsigned Depth = 0);
104104

105+
/// Update \p Known with bits of \p V that are implied by \p Cmp.
106+
/// Comparisons involving `trunc V` are handled specially: known
107+
/// bits are computed for the truncated value and then extended to the bitwidth
108+
/// of \p V.
109+
LLVM_ABI void computeKnownBitsFromICmpCond(const Value *V, ICmpInst *Cmp,
110+
KnownBits &Known,
111+
const SimplifyQuery &SQ,
112+
bool Invert);
113+
105114
/// Using KnownBits LHS/RHS produce the known bits for logic op (and/xor/or).
106115
LLVM_ABI KnownBits analyzeKnownBitsFromAndXorOr(const Operator *I,
107116
const KnownBits &KnownLHS,

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,9 +968,9 @@ static void computeKnownBitsFromCmp(const Value *V, CmpInst::Predicate Pred,
968968
}
969969
}
970970

971-
static void computeKnownBitsFromICmpCond(const Value *V, ICmpInst *Cmp,
972-
KnownBits &Known,
973-
const SimplifyQuery &SQ, bool Invert) {
971+
void llvm::computeKnownBitsFromICmpCond(const Value *V, ICmpInst *Cmp,
972+
KnownBits &Known,
973+
const SimplifyQuery &SQ, bool Invert) {
974974
ICmpInst::Predicate Pred =
975975
Invert ? Cmp->getInversePredicate() : Cmp->getPredicate();
976976
Value *LHS = Cmp->getOperand(0);

0 commit comments

Comments
 (0)