https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35341
Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldot at gcc dot gnu.org
--- Comment #1 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> ---
Did you forget to specify -funroll-loops?
gcc-4.2 -O2 -funroll-loops and gcc-4.4 as well as 5.0 with these options
basically generate this optimized dump, which IIUC is what you want.
;; Function foo (foo)
Analyzing Edge Insertions.
foo ()
{
int temp.34;
int temp.31;
int temp.29;
int temp.26;
int temp.25;
<bb 2>:
temp.25 = a[0];
temp.26 = temp.25 + temp.25;
a[0] = temp.26;
if (temp.26 == 10)
goto <bb 7>;
else
goto <bb 3>;
<bb 3>:
temp.29 = a[2] + a[1];
a[2] = temp.29;
if (temp.29 == 10)
goto <bb 7>;
else
goto <bb 4>;
<bb 4>:
temp.31 = temp.29 + a[4];
a[4] = temp.31;
if (temp.31 == 10)
goto <bb 7>;
else
goto <bb 5>;
<bb 5>:
temp.34 = a[6] + a[3];
a[6] = temp.34;
if (temp.34 == 10)
goto <bb 7>;
else
goto <bb 6>;
<bb 6>:
a[8] = [plus_expr] a[8] + a[4];
<bb 7>:
return 0;
}