[PATCH] D99424: [BasicAA] Be more careful with modulo ops on VariableGEPIndex.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 14:40:50 PDT 2021


fhahn updated this revision to Diff 335931.
fhahn added a comment.

Rebased on top of latest changes.

In D99424#2653505 <https://reviews.llvm.org/D99424#2653505>, @nikic wrote:

> I'm somewhat confused by the implementation approach in this patch. I think there's really two orthogonal cases: The first is if all operations are non-wrapping, in which case we can optimize for arbitrary modulos. The second is that we can always use power of two factors from the GCD, because arithmetic is over a power of two field.
>
> I think handling for these two cases should be split. The first part can be handled via flag, and the second part can be handled by only extracting the power of two part if the flag is not set. I think this should both make the semantics of the flag clear and be more precise.

I'm not sure where the logic should be split? I tried to just have a may-wrap flag and then check if Scale is a power-of-2 when the scale is used for the modulo computations. But I think that wouldn't correctly handle cases like (a + x) * 2^y, if the multiply operand gets distributed. Or were you thinking about something else?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99424/new/

https://reviews.llvm.org/D99424

Files:
  llvm/include/llvm/Analysis/BasicAliasAnalysis.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/test/Analysis/BasicAA/gep-alias.ll
  llvm/test/Analysis/BasicAA/gep-modulo.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99424.335931.patch
Type: text/x-patch
Size: 8031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/0db082b3/attachment.bin>


More information about the llvm-commits mailing list