Fix memcheck interval ends for pointers with negative strides
authorSilviu Baranga <silviu.baranga@arm.com>
Thu, 16 Jul 2015 14:02:58 +0000 (14:02 +0000)
committerSilviu Baranga <silviu.baranga@arm.com>
Thu, 16 Jul 2015 14:02:58 +0000 (14:02 +0000)
commite4877f25bdd5ffd1d02b3ae4576ccd099c51951a
treec6863c9e5d26192e6d619290cbca22eaedd5a889
parent5649b37b0e3ce14ebcd8069c9b0b6c25e35eceeb
Fix memcheck interval ends for pointers with negative strides

Summary:
The checking pointer grouping algorithm assumes that the
starts/ends of the pointers are well formed (start <= end).

The runtime memory checking algorithm also assumes this by doing:

 start0 < end1 && start1 < end0

to detect conflicts. This check only works if start0 <= end0 and
start1 <= end1.

This change correctly orders the interval ends by either checking
the stride (if it is constant) or by using min/max SCEV expressions.

Reviewers: anemet, rengolin

Subscribers: rengolin, llvm-commits

Differential Revision: http://reviews.llvm.org/D11149

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242400 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/LoopAccessAnalysis.cpp
test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll [new file with mode: 0644]