[all-commits] [llvm/llvm-project] ea7d20: [basicaa] Rewrite isGEPBaseAtNegativeOffset in ter...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Mar 3 09:03:49 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ea7d208b780657c236986d7dfd7ba577583fd99a
      https://github.com/llvm/llvm-project/commit/ea7d208b780657c236986d7dfd7ba577583fd99a
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-03-03 (Wed, 03 Mar 2021)

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

  Log Message:
  -----------
  [basicaa] Rewrite isGEPBaseAtNegativeOffset in terms of index difference [mostly NFC]

This is almost purely NFC, it just fits more obviously in the flow of the code now that we've standardized on the index different approach.  The non-NFC bit is that because of canceling the VariableOffsets in the subtract, we can now handle the case where both sides involve a common variable offset.  This isn't an "interesting" improvement; it just happens to fall out of the natural code structure.

One subtle point - the placement of this above the BaseAlias check is important in the original code as this can return NoAlias even when we can't find a relation between the bases otherwise.

Also added some enhancement TODOs noticed while understanding the existing code.

Note: This is slightly different than the LGTMed version.  I fixed the "inbounds" issue Nikita noticed with the original code in e6e5ef4 and rebased this to include the same fix.

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




More information about the All-commits mailing list