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
You use:
or it's negation, several times here. Can we add a variable, or lambda function, etc. to make this repetition unnecessary?