This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/20084] New: missed optimization with conditional and loads and cross jumping
- 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: 19 Feb 2005 16:58:36 -0000
- Subject: [Bug tree-optimization/20084] New: missed optimization with conditional and loads and cross jumping
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Like PR 20083 but a slightly different case, in a way this is missed jump crossing.
The following three functions should produce the same assembly code, f2 is the most optimal code.
Right now on the tcb only f1 and f2 are the same.
int f(int *i, int *j, int *l)
{
int k = 0;
if (*i)
k = 1;
if (*j)
k = 1;
if (*l)
k = 1;
return k;
}
int f1(int *i, int *j, int *l)
{
int k = 0;
if (*i)
k = 1;
else if (*j)
k = 1;
else if (*l)
k = 1;
return k;
}
int f2(int *i, int *j, int *l)
{
int k = 0;
if (*i)
return 1;
if (*j)
return 1;
return (*l)!=0;
}
--
Summary: missed optimization with conditional and loads and cross
jumping
Product: gcc
Version: 4.0.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=20084