This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/31631] New: Folding of A & (1 << B) pessimizes FRE
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Apr 2007 09:56:49 -0000
- Subject: [Bug middle-end/31631] New: Folding of A & (1 << B) pessimizes FRE
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
void
foo (int control2, unsigned long *state, int size)
{
int i;
for(i=0; i<size; i++)
{
if (state[i] & ((unsigned long) 1 << control2))
state[i] ^= ((unsigned long) 1 << control2);
}
}
FRE does not recognize the ((unsigned long) 1 << control2) redundancy
because it looks like
<L0>:;
D.1989_4 = (long unsigned int) i_1;
D.1990_5 = D.1989_4 * 8;
D.1991_6 = (long unsigned int *) D.1990_5;
D.1992_8 = D.1991_6 + state_7(D);
# VUSE <SMT.4_28>
D.1993_9 = *D.1992_8;
D.1994_11 = D.1993_9 >> control2_10(D);
D.1995_12 = (int) D.1994_11;
D.1996_13 = D.1995_12 & 1;
if (D.1996_13 != 0) goto <L1>; else goto <L2>;
<L1>:;
D.1989_19 = D.1989_4;
D.1990_20 = D.1990_5;
D.1991_21 = D.1991_6;
D.1992_22 = D.1992_8;
D.1993_23 = D.1993_9;
D.1998_24 = 1 << control2_10(D);
D.1999_25 = D.1993_23 ^ D.1998_24;
# SMT.4_30 = VDEF <SMT.4_28>
*D.1992_22 = D.1999_25;
This is related to PR29789 where this transformation causes other
pessimization.
--
Summary: Folding of A & (1 << B) pessimizes FRE
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31631