We have dedicated decomposition logic for (add %x, -C), but if we have (add nsw %x, -C) we will first apply the generic logic for NSWAdd, which gives worse results for negative constants in practice. Update the code to first apply the pattern with negative constants. Helps to remove a number of runtime checks in practice: https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2968 Alive2 proofs for the test changes: https://alive2.llvm.org/ce/z/JfR2Ma PR: https://github.com/llvm/llvm-project/pull/164791