------- Comment #2 from pinskia at gcc dot gnu dot org 2010-02-12 22:12 -------
The problem shows up at the tree level and nothing cleans it up after expand
for MIPS.
Take:
int
g (int n, int i)
{
int s = 0;
for (i = 0; i < n; i++)
s += i;
return s;
}
--- CUT ---
For the above code expand on x86_64-linux-gnu produces (I simplified the
branches though but otherwise it is the same as what expand produces):
r64 = %edi # n
r65 = %esi #i
if ( r64 <= 0 ) goto L37
r61 = 0
r62 = 0
L19:
r61 = r61 + r62
r62 = r62 + 1
if ( r62 != r64 ) goto L19
goto L22
L37:
r61 = 0
L22:
r63 = r61
goto L27
....
L27:
%eax = r63
return
-- CUT ---
Notice how we have r61 = 0 which could be moved before the first branch which
allows us to remove a BB.
For x86_64, ce1 moves the r61 above the first branch but does not do it for
mips.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |rtl-optimization
GCC build triplet|*-*-* |
GCC host triplet|*-*-* |
GCC target triplet|mips64-unknown-linux |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42839