[SeparateConstOffsetFromGEP] strengthen the inbounds attribute
authorJingyue Wu <jingyue@google.com>
Thu, 13 Aug 2015 18:48:49 +0000 (18:48 +0000)
committerJingyue Wu <jingyue@google.com>
Thu, 13 Aug 2015 18:48:49 +0000 (18:48 +0000)
commita49e11047c766ae4177616bf764d518c0a0486a5
treef9e521efe16c6a3a75a9c02914f8b510f00a176c
parent218b64b5aede69b9788f9c75ff9e185d9472cd5d
[SeparateConstOffsetFromGEP] strengthen the inbounds attribute

We used to be over-conservative about preserving inbounds. Actually, the second
GEP (which applies the constant offset) can inherit the inbounds attribute of
the original GEP, because the resultant pointer is equivalent to that of the
original GEP. For example,

  x  = GEP inbounds a, i+5
    =>
  y = GEP a, i               // inbounds removed
  x = GEP inbounds y, 5      // inbounds preserved

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244937 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/split-gep-and-gvn-addrspace-addressing-modes.ll
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep-and-gvn.ll
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/value-tracking-domtree.ll
test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll