This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/17116] New: Missed optimization with loop and % (or ands)
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Aug 2004 07:12:35 -0000
- Subject: [Bug tree-optimization/17116] New: Missed optimization with loop and % (or ands)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
main()
{
int i;
for (i=0; i < 90; i++)
{
if (i%2)
puts("hello");
}
}
We get the following thing from .vars:
<bb 0>:
i = 0;
<L0>:;
if ((i & 1) != 0) goto <L1>; else goto <L2>;
when we should get:
<bb 0>:
i = 0;
goto <L2>;
<L0>:;
if ((i & 1) != 0) goto <L1>; else goto <L2>;
Or we could just divide 90 by 2.
--
Summary: Missed optimization with loop and % (or ands)
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17116