[Bug tree-optimization/23286] New: missed fully redundant expression
bonzini at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Aug 8 17:46:00 GMT 2005
In this code, a <<= 1 is fully redundant
unsigned short f(unsigned short a)
{
if (a & 0x8000)
a <<= 1, a = a ^ 0x1021;
else
a <<= 1;
return a;
}
the body should be turned into
unsigned short f(unsigned short a)
{
unsigned short b = a << 1;
if (a & 0x8000)
a = b, a = a ^ 0x1021;
else
a = b;
return a;
}
or something similar. However PRE leaves the GIMPLE unchanged:
f (a)
{
int D.1267;
short int a.0;
<bb 0>:
a.0_3 = (short int) a_2;
if (a.0_3 < 0) goto <L0>; else goto <L1>;
<L0>:;
a_7 = a_2 << 1;
a_8 = a_7 ^ 4129;
goto <bb 3> (<L2>);
<L1>:;
a_6 = a_2 << 1;
# a_1 = PHI <a_8(1), a_6(2)>;
<L2>:;
D.1267_4 = (int) a_1;
return D.1267_4;
}
On PPC, this is only caught after reload.
Paolo
--
Summary: missed fully redundant expression
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bonzini at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23286
More information about the Gcc-bugs
mailing list