[all-commits] [llvm/llvm-project] 9bc7e5: [BasicAA] Make range check more precise

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Oct 27 03:41:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bc7e543b4ef5eef2be2325204db20073fc18e36
      https://github.com/llvm/llvm-project/commit/9bc7e543b4ef5eef2be2325204db20073fc18e36
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M llvm/lib/Analysis/BasicAliasAnalysis.cpp
    M llvm/test/Analysis/BasicAA/range.ll

  Log Message:
  -----------
  [BasicAA] Make range check more precise

Make the range check more precise by calculating the range of
potentially accessed bytes for both accesses and checking whether
their intersection is empty. In that case there can be no overlap
between the accesses and the result is NoAlias.

This is more powerful than the previous approach, because it can
deal with sign-wrapped ranges. In the test case the original range
is [-1, INT_MAX] but becomes [0, INT_MIN] after applying the offset.
This is a wrapping range, so getSignedMin/getSignedMax will treat
it as a full range. However, the range excludes the elements
[INT_MIN+1, -1], which is enough to prove NoAlias with an access
at offset -1.

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




More information about the All-commits mailing list