forked from OSchip/llvm-project
[ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSignBit. NFC
llvm-svn: 302991
This commit is contained in:
parent
3a3e115e81
commit
9fe357971c
|
@ -1284,8 +1284,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
|
||||||
const Value *V = DecompGEP1.VarIndices[i].V;
|
const Value *V = DecompGEP1.VarIndices[i].V;
|
||||||
|
|
||||||
bool SignKnownZero, SignKnownOne;
|
bool SignKnownZero, SignKnownOne;
|
||||||
ComputeSignBit(const_cast<Value *>(V), SignKnownZero, SignKnownOne, DL,
|
ComputeSignBit(V, SignKnownZero, SignKnownOne, DL, 0, &AC, nullptr, DT);
|
||||||
0, &AC, nullptr, DT);
|
|
||||||
|
|
||||||
// Zero-extension widens the variable, and so forces the sign
|
// Zero-extension widens the variable, and so forces the sign
|
||||||
// bit to zero.
|
// bit to zero.
|
||||||
|
|
|
@ -86,13 +86,11 @@ void DemandedBits::determineLiveOperandBits(
|
||||||
[&](unsigned BitWidth, const Value *V1, const Value *V2) {
|
[&](unsigned BitWidth, const Value *V1, const Value *V2) {
|
||||||
const DataLayout &DL = I->getModule()->getDataLayout();
|
const DataLayout &DL = I->getModule()->getDataLayout();
|
||||||
Known = KnownBits(BitWidth);
|
Known = KnownBits(BitWidth);
|
||||||
computeKnownBits(const_cast<Value *>(V1), Known, DL, 0,
|
computeKnownBits(V1, Known, DL, 0, &AC, UserI, &DT);
|
||||||
&AC, UserI, &DT);
|
|
||||||
|
|
||||||
if (V2) {
|
if (V2) {
|
||||||
Known2 = KnownBits(BitWidth);
|
Known2 = KnownBits(BitWidth);
|
||||||
computeKnownBits(const_cast<Value *>(V2), Known2, DL,
|
computeKnownBits(V2, Known2, DL, 0, &AC, UserI, &DT);
|
||||||
0, &AC, UserI, &DT);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7513,8 +7513,7 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
|
||||||
if (TLI->isGAPlusOffset(Ptr.getNode(), GV, GVOffset)) {
|
if (TLI->isGAPlusOffset(Ptr.getNode(), GV, GVOffset)) {
|
||||||
unsigned PtrWidth = getDataLayout().getPointerTypeSizeInBits(GV->getType());
|
unsigned PtrWidth = getDataLayout().getPointerTypeSizeInBits(GV->getType());
|
||||||
KnownBits Known(PtrWidth);
|
KnownBits Known(PtrWidth);
|
||||||
llvm::computeKnownBits(const_cast<GlobalValue *>(GV), Known,
|
llvm::computeKnownBits(GV, Known, getDataLayout());
|
||||||
getDataLayout());
|
|
||||||
unsigned AlignBits = Known.countMinTrailingZeros();
|
unsigned AlignBits = Known.countMinTrailingZeros();
|
||||||
unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
|
unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
|
||||||
if (Align)
|
if (Align)
|
||||||
|
|
Loading…
Reference in New Issue