[InstCombine] sink FP negation of operands through select
authorSanjay Patel <spatel@rotateright.com>
Mon, 6 May 2019 20:34:05 +0000 (20:34 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 6 May 2019 20:34:05 +0000 (20:34 +0000)
commita6019d51649973c88dc5953d98a46a964768deb2
tree65f0732d13f403fa07850245519b622dbd7fc0c7
parent2d2277f5e7ce8b2836e4a5a393a2c4da26c2e439
[InstCombine] sink FP negation of operands through select

We don't always get this:

Cond ? -X : -Y --> -(Cond ? X : Y)

...even with the legacy IR form of fneg in the case with extra uses,
and we miss matching with the newer 'fneg' instruction because we
are expecting binops through the rest of the path.

Differential Revision: https://reviews.llvm.org/D61604

llvm-svn: 360075
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/fneg.ll