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: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org CC: i...@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].