[SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.
authorJingyue Wu <jingyue@google.com>
Fri, 14 Aug 2015 02:02:05 +0000 (02:02 +0000)
committerJingyue Wu <jingyue@google.com>
Fri, 14 Aug 2015 02:02:05 +0000 (02:02 +0000)
commitc4aff77ec0ab43d21c93b20070b9edc517b8a2e1
tree029e683dd6ab0dba74f88795b7ba67f546d238e9
parent0d1a277d93e4cd69c75a7b91b14a152028d52ef6
[SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.

Summary:
This patch implements my promised optimization to reunites certain sexts from
operands after we extract the constant offset. See the header comment of
reuniteExts for its motivation.

One key building block that enables this optimization is Bjarke's poison value
analysis (D11212). That helps to prove "a +nsw b" can't overflow.

Reviewers: broune

Subscribers: jholewinski, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245003 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep-and-gvn.ll