[llvm] 49813f7 - [BasicAA] Pass DecomposedGEP to constantOffsetHeuristic() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 29 13:27:29 PDT 2021
Author: Nikita Popov
Date: 2021-09-29T22:23:27+02:00
New Revision: 49813f7fbf5e18fb4bb15e8aaced27716e9366ba
URL: https://github.com/llvm/llvm-project/commit/49813f7fbf5e18fb4bb15e8aaced27716e9366ba
DIFF: https://github.com/llvm/llvm-project/commit/49813f7fbf5e18fb4bb15e8aaced27716e9366ba.diff
LOG: [BasicAA] Pass DecomposedGEP to constantOffsetHeuristic() (NFC)
Rather than separately passing VarIndices and BaseOffset, pass
the whole DecomposedGEP.
Added:
Modified:
llvm/include/llvm/Analysis/BasicAliasAnalysis.h
llvm/lib/Analysis/BasicAliasAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h
index 39ae5ff2028f1..41df8e527b068 100644
--- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h
@@ -196,9 +196,8 @@ class BasicAAResult : public AAResultBase<BasicAAResult> {
/// However, we know that, for all %x, zext(%x) != zext(%x + 1), even if
/// the addition overflows.
bool
- constantOffsetHeuristic(const SmallVectorImpl<VariableGEPIndex> &VarIndices,
- LocationSize V1Size, LocationSize V2Size,
- const APInt &BaseOffset, AssumptionCache *AC,
+ constantOffsetHeuristic(const DecomposedGEP &GEP, LocationSize V1Size,
+ LocationSize V2Size, AssumptionCache *AC,
DominatorTree *DT);
bool isValueEqualInPotentialCycles(const Value *V1, const Value *V2);
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 911ea6348274a..5e60cbe279409 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1282,8 +1282,7 @@ AliasResult BasicAAResult::aliasGEP(
}
}
- if (constantOffsetHeuristic(DecompGEP1.VarIndices, V1Size, V2Size,
- DecompGEP1.Offset, &AC, DT))
+ if (constantOffsetHeuristic(DecompGEP1, V1Size, V2Size, &AC, DT))
return AliasResult::NoAlias;
}
@@ -1772,17 +1771,16 @@ void BasicAAResult::GetIndexDifference(
}
bool BasicAAResult::constantOffsetHeuristic(
- const SmallVectorImpl<VariableGEPIndex> &VarIndices,
- LocationSize MaybeV1Size, LocationSize MaybeV2Size, const APInt &BaseOffset,
- AssumptionCache *AC, DominatorTree *DT) {
- if (VarIndices.size() != 2 || !MaybeV1Size.hasValue() ||
+ const DecomposedGEP &GEP, LocationSize MaybeV1Size,
+ LocationSize MaybeV2Size, AssumptionCache *AC, DominatorTree *DT) {
+ if (GEP.VarIndices.size() != 2 || !MaybeV1Size.hasValue() ||
!MaybeV2Size.hasValue())
return false;
const uint64_t V1Size = MaybeV1Size.getValue();
const uint64_t V2Size = MaybeV2Size.getValue();
- const VariableGEPIndex &Var0 = VarIndices[0], &Var1 = VarIndices[1];
+ const VariableGEPIndex &Var0 = GEP.VarIndices[0], &Var1 = GEP.VarIndices[1];
if (Var0.ZExtBits != Var1.ZExtBits || Var0.SExtBits != Var1.SExtBits ||
Var0.Scale != -Var1.Scale || Var0.V->getType() != Var1.V->getType())
@@ -1817,8 +1815,8 @@ bool BasicAAResult::constantOffsetHeuristic(
// arithmetic (i.e. for some values of GEP1 and V2 GEP1 < V2, and for other
// values GEP1 > V2). We'll therefore only declare NoAlias if both V1Size and
// V2Size can fit in the MinDiffBytes gap.
- return MinDiffBytes.uge(V1Size + BaseOffset.abs()) &&
- MinDiffBytes.uge(V2Size + BaseOffset.abs());
+ return MinDiffBytes.uge(V1Size + GEP.Offset.abs()) &&
+ MinDiffBytes.uge(V2Size + GEP.Offset.abs());
}
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list