[all-commits] [llvm/llvm-project] 1de107: [DAGCombine] Fix alias analysis for unaligned acce...

David Green via All-commits all-commits at lists.llvm.org
Fri Feb 28 10:46:09 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1de10705594c7a2c9b8fde901c391bd84062ae04
      https://github.com/llvm/llvm-project/commit/1de10705594c7a2c9b8fde901c391bd84062ae04
  Author: David Green <david.green at arm.com>
  Date:   2020-02-28 (Fri, 28 Feb 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/ARM/memset-align.ll

  Log Message:
  -----------
  [DAGCombine] Fix alias analysis for unaligned accesses

The alias analysis in DAG Combine looks at the BaseAlign, the Offset and
the Size of two accesses, and determines if they are known to access
different parts of memory by the fact that they are different offsets
from inside that "alignment window". It does not seem to account for
accesses that are not a multiple of the size, and may overflow from one
alignment window into another.

For example in the test case we have a 19byte memset that is splits into
a 16 byte neon store and an unaligned 4 byte store with a 15 byte
offset. This 15byte offset (with a base align of 8) wraps around to the
next alignment windows. When compared to an access that is a 16byte
offset (of the same 4byte size and 8byte basealign), the two accesses
are said not to alias.

I've fixed this here by just ensuring that the offsets are a multiple of
the size, ensuring that they don't overlap by wrapping. Fixes PR45035,
which was exposed by the UseAA changes in the arm backend.

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




More information about the All-commits mailing list