Skip to content

Commit 1116e4f

Browse files
committed
[ValueTracking] Rename computeKnownBitsFrom{Assume -> Context} (NFC)
In preparation for handling non-assume context-sensitive facts.
1 parent 3c0f871 commit 1116e4f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

llvm/include/llvm/Analysis/ValueTracking.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ void computeKnownBits(const Value *V, KnownBits &Known, unsigned Depth,
8989
/// \p KnownOne the set of bits that are known to be one
9090
void computeKnownBitsFromRangeMetadata(const MDNode &Ranges, KnownBits &Known);
9191

92-
/// Merge bits known from assumes into Known.
93-
void computeKnownBitsFromAssume(const Value *V, KnownBits &Known,
94-
unsigned Depth, const SimplifyQuery &Q);
92+
/// Merge bits known from context-dependent facts into Known.
93+
void computeKnownBitsFromContext(const Value *V, KnownBits &Known,
94+
unsigned Depth, const SimplifyQuery &Q);
9595

9696
/// Using KnownBits LHS/RHS produce the known bits for logic op (and/xor/or).
9797
KnownBits analyzeKnownBitsFromAndXorOr(

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ static void computeKnownBitsFromCmp(const Value *V, CmpInst::Predicate Pred,
711711
}
712712
}
713713

714-
void llvm::computeKnownBitsFromAssume(const Value *V, KnownBits &Known,
714+
void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
715715
unsigned Depth, const SimplifyQuery &Q) {
716716
// Use of assumptions is context-sensitive. If we don't have a context, we
717717
// cannot use them!
@@ -1868,11 +1868,11 @@ void computeKnownBits(const Value *V, const APInt &DemandedElts,
18681868
Known.Zero.setLowBits(Log2(Alignment));
18691869
}
18701870

1871-
// computeKnownBitsFromAssume strictly refines Known.
1871+
// computeKnownBitsFromContext strictly refines Known.
18721872
// Therefore, we run them after computeKnownBitsFromOperator.
18731873

1874-
// Check whether a nearby assume intrinsic can determine some known bits.
1875-
computeKnownBitsFromAssume(V, Known, Depth, Q);
1874+
// Check whether we can determine known bits from context such as assumes.
1875+
computeKnownBitsFromContext(V, Known, Depth, Q);
18761876

18771877
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
18781878
}
@@ -6338,14 +6338,14 @@ computeOverflowForSignedAdd(const WithCache<const Value *> &LHS,
63386338
// CANNOT overflow. If this can be determined from the known bits of the
63396339
// operands the above signedAddMayOverflow() check will have already done so.
63406340
// The only other way to improve on the known bits is from an assumption, so
6341-
// call computeKnownBitsFromAssume() directly.
6341+
// call computeKnownBitsFromContext() directly.
63426342
bool LHSOrRHSKnownNonNegative =
63436343
(LHSRange.isAllNonNegative() || RHSRange.isAllNonNegative());
63446344
bool LHSOrRHSKnownNegative =
63456345
(LHSRange.isAllNegative() || RHSRange.isAllNegative());
63466346
if (LHSOrRHSKnownNonNegative || LHSOrRHSKnownNegative) {
63476347
KnownBits AddKnown(LHSRange.getBitWidth());
6348-
computeKnownBitsFromAssume(Add, AddKnown, /*Depth=*/0, SQ);
6348+
computeKnownBitsFromContext(Add, AddKnown, /*Depth=*/0, SQ);
63496349
if ((AddKnown.isNonNegative() && LHSOrRHSKnownNonNegative) ||
63506350
(AddKnown.isNegative() && LHSOrRHSKnownNegative))
63516351
return OverflowResult::NeverOverflows;

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedBits(
10521052
computeKnownBits(I->getOperand(1), RHSKnown, Depth + 1, CxtI);
10531053
computeKnownBits(I->getOperand(0), LHSKnown, Depth + 1, CxtI);
10541054
Known = LHSKnown & RHSKnown;
1055-
computeKnownBitsFromAssume(I, Known, Depth, SQ.getWithInstruction(CxtI));
1055+
computeKnownBitsFromContext(I, Known, Depth, SQ.getWithInstruction(CxtI));
10561056

10571057
// If the client is only demanding bits that we know, return the known
10581058
// constant.
@@ -1072,7 +1072,7 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedBits(
10721072
computeKnownBits(I->getOperand(1), RHSKnown, Depth + 1, CxtI);
10731073
computeKnownBits(I->getOperand(0), LHSKnown, Depth + 1, CxtI);
10741074
Known = LHSKnown | RHSKnown;
1075-
computeKnownBitsFromAssume(I, Known, Depth, SQ.getWithInstruction(CxtI));
1075+
computeKnownBitsFromContext(I, Known, Depth, SQ.getWithInstruction(CxtI));
10761076

10771077
// If the client is only demanding bits that we know, return the known
10781078
// constant.
@@ -1094,7 +1094,7 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedBits(
10941094
computeKnownBits(I->getOperand(1), RHSKnown, Depth + 1, CxtI);
10951095
computeKnownBits(I->getOperand(0), LHSKnown, Depth + 1, CxtI);
10961096
Known = LHSKnown ^ RHSKnown;
1097-
computeKnownBitsFromAssume(I, Known, Depth, SQ.getWithInstruction(CxtI));
1097+
computeKnownBitsFromContext(I, Known, Depth, SQ.getWithInstruction(CxtI));
10981098

10991099
// If the client is only demanding bits that we know, return the known
11001100
// constant.
@@ -1127,7 +1127,7 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedBits(
11271127

11281128
bool NSW = cast<OverflowingBinaryOperator>(I)->hasNoSignedWrap();
11291129
Known = KnownBits::computeForAddSub(/*Add*/ true, NSW, LHSKnown, RHSKnown);
1130-
computeKnownBitsFromAssume(I, Known, Depth, SQ.getWithInstruction(CxtI));
1130+
computeKnownBitsFromContext(I, Known, Depth, SQ.getWithInstruction(CxtI));
11311131
break;
11321132
}
11331133
case Instruction::Sub: {
@@ -1143,7 +1143,7 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedBits(
11431143
bool NSW = cast<OverflowingBinaryOperator>(I)->hasNoSignedWrap();
11441144
computeKnownBits(I->getOperand(0), LHSKnown, Depth + 1, CxtI);
11451145
Known = KnownBits::computeForAddSub(/*Add*/ false, NSW, LHSKnown, RHSKnown);
1146-
computeKnownBitsFromAssume(I, Known, Depth, SQ.getWithInstruction(CxtI));
1146+
computeKnownBitsFromContext(I, Known, Depth, SQ.getWithInstruction(CxtI));
11471147
break;
11481148
}
11491149
case Instruction::AShr: {

0 commit comments

Comments
 (0)