This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/15350] New: [tree-ssa] Convert if ((1 << a) & 1) into if (a == 0).
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 May 2004 19:50:47 -0000
- Subject: [Bug optimization/15350] New: [tree-ssa] Convert if ((1 << a) & 1) into if (a == 0).
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Convert foo() into baz().
void bar (void);
void
foo (int a)
{
int b = 1 << a;
if (b & 1)
bar ();
}
void
baz (int a)
{
if (a == 0)
bar ();
}
You might think this is so artificial but actually comes from
simplify_comparison() in combine.c, a part of which looks like
<L344>:;
T.4338_976 = (int)T.4337_966;
T.4546_977 = T.4338_976 - 1;
T.4547_978 = 1 << T.4546_977;
T.4548_979 = T.4547_978 & 1;
T.4549_980 = (_Bool)T.4548_979;
if (T.4549_980 == 0) goto <L555>; else goto <L345>;
--
Summary: [tree-ssa] Convert if ((1 << a) & 1) into if (a == 0).
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15350