[PATCH] D59648: [BasicAliasAnalysis] Fix computation for large arrays

Eugene Sharygin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 08:47:45 PDT 2019


eush created this revision.
eush added reviewers: efriedma, hfinkel, george.burgess.iv.
Herald added a subscriber: jdoerfert.
Herald added a project: LLVM.

This fixes alias analysis rules to support arrays larger than half of
the address space by teaching BasicAliasAnalysis about offset
wraparound.

The problem is that BasicAliasAnalysis reduces all pointer offsets to
APInt with PointerSize bits (by calling `adjustToPointerSize`), but then
performs arithmetic operations in APInt with MaxPointerSize bits. In the
case when PointerSize is not equal to MaxPointerSize, this leads to all
offsets larger than half of the address space size being treated as
negative integers, and certain heuristics producing incorrect results if
such offsets are involved.

This fixes PR34344 and the test reported on llvm-dev in 118901 [1].

[1]: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118901.html


Repository:
  rL LLVM

https://reviews.llvm.org/D59648

Files:
  include/llvm/Analysis/BasicAliasAnalysis.h
  lib/Analysis/BasicAliasAnalysis.cpp
  test/Analysis/BasicAA/cs-cs.ll
  test/Analysis/BasicAA/huge-array.ll
  test/Analysis/BasicAA/pr34344.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59648.191712.patch
Type: text/x-patch
Size: 15667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190321/bf2a63b7/attachment-0001.bin>


More information about the llvm-commits mailing list