[llvm] [BasicAA] Refactor offset-based heuristics in `aliasGEP`, unify style (NFC) (PR #218687)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 12:48:50 PDT 2026


================
@@ -116,6 +117,19 @@ class BasicAAResult : public AAResultBase {
   DecomposeGEPExpression(const Value *V, const DataLayout &DL,
                          AssumptionCache *AC, DominatorTree *DT);
 
+  /// Analyze the variable indices of a decomposed GEP, computing the GCD
+  /// that each Scale*V term is a multiple of, and an approximate range of
+  /// possible total offsets.
+  VariableGEPOffsetInfo analyzeVariableOffsets(const DecomposedGEP &GEP,
+                                               DominatorTree *DT);
+
+  /// Try to determine the range of values for VarIndex such that
+  /// VarIndex <= -MinAbsVarIndex || MinAbsVarIndex <= VarIndex, thus
+  /// establishing a minimum absolute value of the variable offset.
+  std::optional<APInt> computeMinAbsVarIndexHeuristic(const DecomposedGEP &GEP,
----------------
nikic wrote:

I think that's fine.

https://github.com/llvm/llvm-project/pull/218687


More information about the llvm-commits mailing list