[PATCH] D91027: [BasicAA] Generalize base offset modulus handling
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 10:05:04 PST 2020
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/BasicAliasAnalysis.cpp:1399
+ (GCD - ModOffset).uge(V1Size.getValue()))
return NoAlias;
----------------
jdoerfert wrote:
> Maybe a comment above this to explain, I don't get the reasoning TBH.
>
> Here is my idea of what is happening but it is not complete:
> ```
> // X[0:N] is a vector of N+1 unknowns
> GEP1 = GEP1BaseOffset + X[0:N] * GEP1.scale[0:N]
> GCD = gcd(GEP1.scale[0], ..., GEP1.scale[N])
> ModOffset = GEP1BaseOffset % GCD
> // Every value of GEP1 looks like: GEP1 := Y * GCD + ModOffset
> // and ModOffset < GCD.
> Diff = GCD - ModOffset
> if (ModOffset >=u V2Size // I guess V2 fits in the size between Y * GCD and GEP1
> && Diff >=u V1Size // this I don't understand.
> return NoAlias;
> ```
Does the new comment make sense to you? We have the second access at [0..V2Size) with the remaining [V2Size..GCD) not being accessed. We don't alias if the first access fits in there, i.e. ModOffset >= V2Size and ModOffset+V1Size <= GCD.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91027/new/
https://reviews.llvm.org/D91027
More information about the llvm-commits
mailing list