------- Comment #5 from rguenth at gcc dot gnu dot org 2008-04-29 09:55 -------
For the testcase in comment #4 after FRE we have
c_2 = a_1(D) + 4;
d_3 = c_2 * 2;
e_4 = a_1(D) * 2;
f_5 = e_4 + 4;
D.1557_6 = f_5 + d_3;
return D.1557_6;
And a patched reassoc pass then produces
c_2 = a_1(D) + a_1(D);
D.1565_8 = c_2 + 4;
D.1565_9 = D.1565_8 * 2;
D.1557_6 = 4 + D.1565_9;
return D.1557_6;
which is ((a + a) + 4) * 2 + 4.
The original testcase gets optimized to
return (a + 2) * 2 == a * 2 + 4;
which makes this bug related to PR15255 which is about missing foldings.
tree-ssa-reassoc should also transform (a + C1) * C2 to a * 2 + C3.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15255
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-05-28 10:27:18 |2008-04-29 09:55:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32120