-funswitch-loops not effective?

Andrew Pinski pinskia@physics.uc.edu
Mon Jan 17 17:00:00 GMT 2005


On Jan 17, 2005, at 7:25 AM, Richard Guenther wrote:

> On Mon, 17 Jan 2005, Richard Guenther wrote:
>
> What I don't quite understand is why in the following testcase, 
> unswitching
> is happening:
>
> void foo(int);
> void bar(int);
>
> extern const _Bool flag;
>
> void foobar(int n)
> {
>         int i;
>         for (i=0; i<n; ++i)
>                 if (flag)
>                         foo(i);
>                 else
>                         bar(i);
> }


Because even though flag is const in this TU, but does
not have to be in a different TU, which case foo and bar
can modify flag.  If you look at the tree dumps with
the vops turned on, you will see this.

-- Pinski



More information about the Gcc mailing list