[PATCH] D92723: [BasicAA] Migrate "same base pointer" logic to decomposed GEPs

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 5 12:39:55 PST 2020


nikic created this revision.
nikic added reviewers: asbirlea, jdoerfert, reames.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

BasicAA has some special bit of logic for "same base pointer" GEPs that performs a structural comparison: It only looks at two GEPs with the same base (as opposed to two GEP chains with a MustAlias base) and compares their indexes in a limited way. I generalized part of this code in D91027 <https://reviews.llvm.org/D91027>, and this patch merges the remainder into the normal decomposed GEP logic.

What this code ultimately wants to do is to determine that `gep %base, %idx1` and `gep %base, %idx2` don't alias if `%idx1 != %idx2`, and the access size fits within the stride.

We can express this in terms of a decomposed GEP expression with two indexes `scale*%idx1 + -scale*%idx2` where `%idx1 != %idx2`, and some appropriate checks for sizes and offsets.

This makes the reasoning slightly more powerful, and more importantly brings all the GEP logic under a common umbrella.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92723

Files:
  llvm/include/llvm/Analysis/BasicAliasAnalysis.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/test/Analysis/BasicAA/fallback-mayalias.ll
  llvm/test/Analysis/BasicAA/sequential-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92723.309745.patch
Type: text/x-patch
Size: 11584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201205/561b8a91/attachment.bin>


More information about the llvm-commits mailing list