------- Comment #6 from pinskia at gcc dot gnu dot org 2007-06-02 00:21 ------- (In reply to comment #5) > We moved a multiply, which is outside of loop in source, into > a loop. I don't think gcc should do it with any optimization > flag, including -ffast-math.
Yes but this is still just a missed optimization rather than a wrong code issue. reassoc2 is not checking if it is going to move stuff in the loop. --- foo.c.107t.recip 2007-06-01 17:18:04.000000000 -0700 +++ foo.c.108t.reassoc2 2007-06-01 17:18:04.000000000 -0700 @@ -178,15 +178,15 @@ cmn_prior (incep, varnorm, nfr, ceplen, goto <bb 8> (<L64>); <L102>:; - D.1857_156 = nframe_lsm.64_93 + 1; D.1858_191 = (unsigned int) nfr_17(D); D.1859_190 = D.1858_191 + 0x0ffffffff; D.1860_52 = (int32) D.1859_190; + D.1857_156 = nframe_lsm.64_93 + 1; nframe_lsm.64_35 = D.1857_156 + D.1860_52; - D.1861_38 = nframe_lsm.64_93 + 1; D.1862_37 = (unsigned int) nfr_17(D); D.1863_155 = D.1862_37 + 0x0ffffffff; D.1864_6 = (int) D.1863_155; + D.1861_38 = nframe_lsm.64_93 + 1; nframe.8_36 = D.1861_38 + D.1864_6; # nframe_73 = VDEF <nframe_134> nframe = nframe_lsm.64_35; @@ -217,7 +217,7 @@ cmn_prior (incep, varnorm, nfr, ceplen, D.1890_104 = (unsigned int) i_14; # VUSE <SMT.14_63> D.1709_89 = MEM[base: sum.6_87, index: D.1890_104, step: 4]; - D.1710_90 = D.1709_89 * sf_77; + D.1710_90 = sf_77 * D.1709_89; D.1891_102 = (unsigned int) i_14; # SMT.14_183 = VDEF <SMT.14_63> MEM[base: cur_mean.3_82, index: D.1891_102, step: 4] = D.1710_90; -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dberlin at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2007-06-02 00:21:27 date| | Summary|-fast-math moves multiply |reassoc can more extra |into a loop |calculations into a loop http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32183