Add an InstCombine transform to recognize instances of manual overflow-safe addition
authorOwen Anderson <resistor@mac.com>
Wed, 15 Dec 2010 22:32:38 +0000 (22:32 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 15 Dec 2010 22:32:38 +0000 (22:32 +0000)
commit12984de3140534da4f312190118726963a2b521e
tree3de799bb13ddb25aae0f2ba6cc629109aeef63d6
parente194b26ffd23aa464324429323647af4fcb7df7b
Add an InstCombine transform to recognize instances of manual overflow-safe addition
(performing the addition in a wider type and explicitly checking for overflow), and
fold them down to intrinsics.  This currently only supports signed-addition, but could
be generalized if someone works out the magic constant formulas for other operations.

Fixes <rdar://problem/8558713>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121905 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/overflow.ll [new file with mode: 0644]