This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/23286] missed fully redundant expression
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Nov 2008 13:22:44 -0000
- Subject: [Bug tree-optimization/23286] missed fully redundant expression
- References: <bug-23286-7849@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #18 from steven at gcc dot gnu dot org 2008-11-23 13:22 -------
The test case of PR38204 shows one of the problems with proof-of-concept patch,
namely the "don't move up too much" problem. The .pre dump looks like this:
test (int a, int b, int c, int g)
{
int pretmp.11;
int e;
int d;
int D.1257;
int D.1256;
<bb 2>:
pretmp.11_11 = b_3(D) * c_4(D);
pretmp.11_12 = g_8(D) + pretmp.11_11; // No need to move this up to here.
if (a_2(D) != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
d_5 = pretmp.11_11;
goto <bb 5>;
<bb 4>:
d_6 = b_3(D) - c_4(D);
<bb 5>:
# d_1 = PHI <d_5(3), d_6(4)>
D.1256_7 = pretmp.11_11;
e_9 = pretmp.11_12;
D.1257_10 = e_9 + d_1;
return D.1257_10;
}
Eventually this gives (in the .final_cleanup dump):
;; Function test (test)
test (int a, int b, int c, int g)
{
int d.21;
int d;
<bb 2>:
d.21 = c * b;
if (a != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
d = d.21;
goto <bb 5>;
<bb 4>:
d = b - c;
<bb 5>:
return (d.21 + g) + d;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23286