[PATCH] D110642: Add ability to detect no-alias between different fields of the same structure

Paul Osmialowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 10:53:37 PDT 2021


pawosm01 created this revision.
pawosm01 added a project: LLVM.
Herald added subscribers: jeroen.dobbelaere, hiraditya.
pawosm01 requested review of this revision.
Herald added a subscriber: llvm-commits.

BasicAliasAnalysis tends to give up on proving no-aliasing between
two memory accesses when they share the same underlying object (e.g
when they are fields of the same structure). Such simplified approach
results in losing optimization opportunities that competing compilers
are able to exploit. Namely, when a loop invariant is loaded from the
i-th element of some array being a field of some global structure and
on each iteration i-th element of another array being a different
field of the same global structure is written to, the load is not
hoisted resulting in tragic performance at -O3 comparing to what
other compiler can achieve at the same optimization level.

This patch add some additional logic that checks just for that:
it returns NoAlias when accessed elements of the same underlying
object are two different fields of the same structure.

Some of the test cases had to be modified in global_alias.ll which
represented the situation addressed by this patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110642

Files:
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/test/Transforms/LoopVectorize/global_alias.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110642.375644.patch
Type: text/x-patch
Size: 4020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210928/d5ede706/attachment.bin>


More information about the llvm-commits mailing list