[InstCombine] fix propagation of FMF through select-of-fnegs
authorSanjay Patel <spatel@octomac.myfiosgateway.com>
Tue, 31 Aug 2021 13:42:13 +0000 (09:42 -0400)
committerSanjay Patel <spatel@octomac.myfiosgateway.com>
Tue, 31 Aug 2021 13:52:17 +0000 (09:52 -0400)
commit5d7d689edf01e41d908ced188efcc6405627fd2b
tree9666fd7539776127e8b78905c00a1c0c31178a38
parent22efb9d364b4b7be27a1a02100d9b35d719906be
[InstCombine] fix propagation of FMF through select-of-fnegs

The existing code was unquestionably wrong - it looked at one
fneg and ignored the other 2 instructions.

It was also untested, so it didn't make the list of bugs
flagged by Alive2.

This is an unusual propagation, but Alive2 agress that we
can intersect the fnegs and union that with the select,
then apply the results to both new instructions:
https://alive2.llvm.org/ce/z/SF8_dt
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/fneg.ll