[ScopInfo] Always derive upper and lower bounds for parameters
commit48f4b42adf88f635912995c350ed1eb3edd7c8ff
authorTobias Grosser <tobias@grosser.es>
Thu, 16 Feb 2017 18:39:14 +0000 (16 18:39 +0000)
committerTobias Grosser <tobias@grosser.es>
Thu, 16 Feb 2017 18:39:14 +0000 (16 18:39 +0000)
tree12ca7b4052431b51b1b07d349d8438ba84d251aa
parent595f63f7cb64292043a2425f766c5f70b9c0bdae
[ScopInfo] Always derive upper and lower bounds for parameters

Commit r230230 introduced the use of range metadata to derive bounds for
parameters, instead of just looking at the type of the parameter. As part of
this commit support for wrapping ranges was added, where the lower bound of a
parameter is larger than the upper bound:

  { 255 < p || p < 0 }

However, at the same time, for wrapping ranges support for adding bounds given
by the size of the containing type has acidentally been dropped. As a result,
the range of the parameters was not guaranteed to be bounded any more. This
change makes sure we always add the bounds given by the size of the type and
then additionally add bounds based on signed wrapping, if available. For a
parameter p with a type size of 32 bit, the valid range is then:

  { -2147483648 <= p <= 2147483647 and (255 < p or p < 0) }

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@295349 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScopInfo.cpp
test/ScopInfo/ranged_parameter_wrap.ll