[all-commits] [llvm/llvm-project] 5e69e2: [BasicAA] Migrate "same base pointer" logic to dec...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Dec 6 01:36:09 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5e69e2ebad9db2af44362ebe1755c08af002798f
      https://github.com/llvm/llvm-project/commit/5e69e2ebad9db2af44362ebe1755c08af002798f
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-12-06 (Sun, 06 Dec 2020)

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

  Log Message:
  -----------
  [BasicAA] Migrate "same base pointer" logic to decomposed GEPs

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, 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.

Differential Revision: https://reviews.llvm.org/D92723




More information about the All-commits mailing list