This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -funswitch-loops not effective?


On Mon, 17 Jan 2005 10:52:38 -0500, Andrew Pinski
<pinskia@physics.uc.edu> wrote:
> 
> On Jan 17, 2005, at 7:25 AM, Richard Guenther wrote:
> 
> 
> 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.

Well, I don't know if I read the tree dumps right, but for the
testcase

extern const _Bool flag;

void bar(void);

void foo(void)
{
        if (flag)
                bar();
        if (flag)
                bar();
}

we get with -O2

foo ()
{
  int D.1123;
  const _Bool flag.0;

<bb 0>:
  if (flag != 0) goto <L0>; else goto <L3>;

<L0>:;
  #   VUSE <flag_1>;
  bar ();
  #   VUSE <flag_1>;
  bar () [tail call];

<L3>:;
  return;

}

as the optimized tree dump.  Is this a valid transformation as you seem to
oppose to?

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]