[ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSignBit. NFC

llvm-svn: 302991
This commit is contained in:
Craig Topper 2017-05-13 17:22:16 +00:00
parent 3a3e115e81
commit 9fe357971c
3 changed files with 4 additions and 8 deletions

View File

@ -1284,8 +1284,7 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
const Value *V = DecompGEP1.VarIndices[i].V;
bool SignKnownZero, SignKnownOne;
ComputeSignBit(const_cast<Value *>(V), SignKnownZero, SignKnownOne, DL,
0, &AC, nullptr, DT);
ComputeSignBit(V, SignKnownZero, SignKnownOne, DL, 0, &AC, nullptr, DT);
// Zero-extension widens the variable, and so forces the sign
// bit to zero.

View File

@ -86,13 +86,11 @@ void DemandedBits::determineLiveOperandBits(
[&](unsigned BitWidth, const Value *V1, const Value *V2) {
const DataLayout &DL = I->getModule()->getDataLayout();
Known = KnownBits(BitWidth);
computeKnownBits(const_cast<Value *>(V1), Known, DL, 0,
&AC, UserI, &DT);
computeKnownBits(V1, Known, DL, 0, &AC, UserI, &DT);
if (V2) {
Known2 = KnownBits(BitWidth);
computeKnownBits(const_cast<Value *>(V2), Known2, DL,
0, &AC, UserI, &DT);
computeKnownBits(V2, Known2, DL, 0, &AC, UserI, &DT);
}
};

View File

@ -7513,8 +7513,7 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
if (TLI->isGAPlusOffset(Ptr.getNode(), GV, GVOffset)) {
unsigned PtrWidth = getDataLayout().getPointerTypeSizeInBits(GV->getType());
KnownBits Known(PtrWidth);
llvm::computeKnownBits(const_cast<GlobalValue *>(GV), Known,
getDataLayout());
llvm::computeKnownBits(GV, Known, getDataLayout());
unsigned AlignBits = Known.countMinTrailingZeros();
unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
if (Align)