InstCombine: sub nsw %x, C -> add nsw %x, -C if C isn't INT_MIN
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 22 Aug 2014 16:41:23 +0000 (16:41 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 22 Aug 2014 16:41:23 +0000 (16:41 +0000)
commit0e4fc41b0d952f8185af8c4199efa2a3571f2552
tree6a7f740a0c6523b7572a88e6f22cbf2f2a08f09d
parent4ef54c3f85f296ea5c80969ce47a1d80856ebc8a
InstCombine: sub nsw %x, C -> add nsw %x, -C if C isn't INT_MIN

We can preserve nsw during this transform if -C won't overflow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216269 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Constant.h
lib/IR/Constants.cpp
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/sub.ll