[vox-tech] another gcc question

Gabriel Rosa vox-tech@lists.lugod.org
Wed, 27 Feb 2002 09:36:32 -0800 (PST)


On Wed, 27 Feb 2002, Peter Jay Salzman wrote:

> another optimization question:
>
>    int n = 5;
>    for (i=0; i<n; ++i)
>
> can gcc unroll this loop the way it can (for instance)
>
>    #define N 5
>    for (i=0; i<N; ++i)

Refer to previous answer.
if you use -funroll-all-loops, yes.

> if it can't, what about
>
>    const int n = 5;
> 	for (i=0; i<n; ++i)
>

const int still gets allocated at run/load time, so I'd imagine
-funroll-loops would not unroll this.

-Gabe