BasicAAResult::constantOffsetHeuristic - pass APInt arg as const reference. NFCI.

Avoids unnecessary APInt copies and silences clang tidy warning.
This commit is contained in:
Simon Pilgrim 2020-07-09 11:51:24 +01:00
parent 97106f9d80
commit 4597bfddf1
2 changed files with 3 additions and 3 deletions

View File

@ -189,7 +189,7 @@ private:
bool bool
constantOffsetHeuristic(const SmallVectorImpl<VariableGEPIndex> &VarIndices, constantOffsetHeuristic(const SmallVectorImpl<VariableGEPIndex> &VarIndices,
LocationSize V1Size, LocationSize V2Size, LocationSize V1Size, LocationSize V2Size,
APInt BaseOffset, AssumptionCache *AC, const APInt &BaseOffset, AssumptionCache *AC,
DominatorTree *DT); DominatorTree *DT);
bool isValueEqualInPotentialCycles(const Value *V1, const Value *V2); bool isValueEqualInPotentialCycles(const Value *V1, const Value *V2);

View File

@ -433,7 +433,7 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL,
/// an issue, for example, in particular for 32b pointers with negative indices /// an issue, for example, in particular for 32b pointers with negative indices
/// that rely on two's complement wrap-arounds for precise alias information /// that rely on two's complement wrap-arounds for precise alias information
/// where the maximum pointer size is 64b. /// where the maximum pointer size is 64b.
static APInt adjustToPointerSize(APInt Offset, unsigned PointerSize) { static APInt adjustToPointerSize(const APInt &Offset, unsigned PointerSize) {
assert(PointerSize <= Offset.getBitWidth() && "Invalid PointerSize!"); assert(PointerSize <= Offset.getBitWidth() && "Invalid PointerSize!");
unsigned ShiftBits = Offset.getBitWidth() - PointerSize; unsigned ShiftBits = Offset.getBitWidth() - PointerSize;
return (Offset << ShiftBits).ashr(ShiftBits); return (Offset << ShiftBits).ashr(ShiftBits);
@ -1993,7 +1993,7 @@ void BasicAAResult::GetIndexDifference(
bool BasicAAResult::constantOffsetHeuristic( bool BasicAAResult::constantOffsetHeuristic(
const SmallVectorImpl<VariableGEPIndex> &VarIndices, const SmallVectorImpl<VariableGEPIndex> &VarIndices,
LocationSize MaybeV1Size, LocationSize MaybeV2Size, APInt BaseOffset, LocationSize MaybeV1Size, LocationSize MaybeV2Size, const APInt &BaseOffset,
AssumptionCache *AC, DominatorTree *DT) { AssumptionCache *AC, DominatorTree *DT) {
if (VarIndices.size() != 2 || MaybeV1Size == LocationSize::unknown() || if (VarIndices.size() != 2 || MaybeV1Size == LocationSize::unknown() ||
MaybeV2Size == LocationSize::unknown()) MaybeV2Size == LocationSize::unknown())