[ScopInfo] Add support for wrap-around of integers in unsigned comparisons.
commitf8fb2733d907bb01e4b52b20cfdf9eb07ef14733
authorMichael Kruse <llvm@meinersbur.de>
Thu, 20 Jul 2017 12:37:02 +0000 (20 12:37 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Thu, 20 Jul 2017 12:37:02 +0000 (20 12:37 +0000)
tree02b857d0d8896e1bf8cf2b57b8ebc3c753161c42
parenta2f1c401ac85fd1314cea30b3f44bba1142ce9e9
[ScopInfo] Add support for wrap-around of integers in unsigned comparisons.

This is one possible solution to implement wrap-arounds for integers in
unsigned icmp operations. For example,

    store i32 -1, i32* %A_addr
    %0 = load i32, i32* %A_addr
    %1 = icmp ult i32 %0, 0

%1 should hold false, because under the assumption of unsigned integers,
-1 should wrap around to 2^32-1. However, previously. it was assumed
that the MSB (Most Significant Bit - aka the Sign bit) was never set for
integers in unsigned operations.

This patch modifies the buildConditionSets function in ScopInfo.cpp to
give better information about the integers in these unsigned
comparisons.

Contributed-by: Annanay Agarwal <cs14btech11001@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35464

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@308608 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScopInfo.cpp
test/ScopInfo/simple_loop_unsigned.ll
test/ScopInfo/simple_loop_unsigned_3.ll
test/ScopInfo/unsigned_wrap_uge.ll [new file with mode: 0644]
test/ScopInfo/unsigned_wrap_ugt.ll [new file with mode: 0644]
test/ScopInfo/unsigned_wrap_ule.ll [new file with mode: 0644]
test/ScopInfo/unsigned_wrap_ult.ll [new file with mode: 0644]
test/ScopInfo/zero_ext_of_truncate.ll
test/ScopInfo/zero_ext_of_truncate_2.ll