Skip to content

Commit e757950

Browse files
committed
[InstCombine] Export computeKnownBitsFromCond in ValueTracking
to use `Cond` in `SelectInst` for compute KnownBits.
1 parent 7c443f8 commit e757950

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

llvm/include/llvm/Analysis/ValueTracking.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ void computeKnownBitsFromRangeMetadata(const MDNode &Ranges, KnownBits &Known);
9494
void computeKnownBitsFromContext(const Value *V, KnownBits &Known,
9595
unsigned Depth, const SimplifyQuery &Q);
9696

97+
void computeKnownBitsFromCond(const Value *V, Value *Cond, KnownBits &Known,
98+
unsigned Depth, const SimplifyQuery &SQ,
99+
bool Invert);
100+
97101
/// Using KnownBits LHS/RHS produce the known bits for logic op (and/xor/or).
98102
KnownBits analyzeKnownBitsFromAndXorOr(const Operator *I,
99103
const KnownBits &KnownLHS,

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,9 @@ static void computeKnownBitsFromICmpCond(const Value *V, ICmpInst *Cmp,
735735
computeKnownBitsFromCmp(V, Pred, LHS, RHS, Known, SQ);
736736
}
737737

738-
static void computeKnownBitsFromCond(const Value *V, Value *Cond,
739-
KnownBits &Known, unsigned Depth,
740-
const SimplifyQuery &SQ, bool Invert) {
738+
void llvm::computeKnownBitsFromCond(const Value *V, Value *Cond,
739+
KnownBits &Known, unsigned Depth,
740+
const SimplifyQuery &SQ, bool Invert) {
741741
Value *A, *B;
742742
if (Depth < MaxAnalysisRecursionDepth &&
743743
match(Cond, m_LogicalOp(m_Value(A), m_Value(B)))) {

0 commit comments

Comments
 (0)