This is the final step for https://reviews.llvm.org/D146903 .
On transform ~X + C --> (C-1) - X, we can safely attach NSW to (C-1) - X if the 1,2 are satisfied
- ~X + C has NSW
- C-1 won't signed overflow
proof: https://alive2.llvm.org/ce/z/ZWmZLv
precommit tests: https://reviews.llvm.org/D152089
This will resolve https://reviews.llvm.org/D146903 's InstCombine part.
Motivational Transformation: https://alive2.llvm.org/ce/z/-_FdJU
I think we could have a few additional tests here: