[InstCombine] Negator: -(cond ? x : -x) --> cond ? -x : x
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 5 Aug 2020 18:20:47 +0000 (21:20 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 5 Aug 2020 18:47:30 +0000 (21:47 +0300)
commitf3056dcc02d5dcde1669f61084a940e1ded3dfda
tree28626140da338c46b1408d80c5ddd1729a415f2e
parent1d25d0734a15d03f1356735719e04a517a1a8a96
[InstCombine] Negator: -(cond ? x : -x)  -->  cond ? -x : x

We were errneously only doing that for old-style abs/nabs,
but we have no such legality check on the condition of the select.

https://rise4fun.com/Alive/xBHS
llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
llvm/test/Transforms/InstCombine/sub-of-negatible.ll