https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89956
--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- Author: rsandifo Date: Fri Apr 5 07:31:12 2019 New Revision: 270162 URL: https://gcc.gnu.org/viewcvs?rev=270162&root=gcc&view=rev Log: Make FMA code cope with redundant negates (PR89956) This patch fixes a case in which, due to forced missed optimisations in earlier passes, we have: _1 = a * b _2 = -_1 _3 = -_1 _4 = _2 + _3 and treated _4 as two FNMA candidates, once via _2 and once via _3. 2019-04-05 Richard Sandiford <richard.sandif...@arm.com> gcc/ PR tree-optimization/89956 * tree-ssa-math-opts.c (convert_mult_to_fma): Protect against multiple negates of the same value. gcc/testsuite/ PR tree-optimization/89956 * gfortran.dg/pr89956.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/pr89956.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-math-opts.c