This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/46009] New: ?: vectorized, very similar if is not
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Oct 2010 16:54:41 +0000
- Subject: [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46009
Summary: ?: vectorized, very similar if is not
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
CC: irar@gcc.gnu.org
void bar (int *);
void foo (int *a, int *b, int *c, int *d)
{
int e[1024], i, g;
for (i = 0; i < 1024; i++)
{
g = a[i] + b[i] + c[i] * d[i];;
#ifdef WORKS
e[i] = g < 10 ? 1 : g;
#else
if (g < 10)
e[i] = 1;
else
e[i] = g;
#endif
}
bar (e);
}
is vectorized only if -DWORKS -O3, but not for -O3, although the code is really
identical. Not sure if ifcvt should handle this, or instead some earlier pass
should detect that both bbs have the same memory destination and change
if (g_25 <= 9)
goto <bb 4>;
else
goto <bb 5>;
<bb 4>:
e[i_14] = 1;
goto <bb 6>;
<bb 5>:
e[i_14] = g_25;
<bb 6>:
into an unconditional assignment of a PHI result into e[i].