This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/19507] missed tree-optimization (constant for the rest of the function)


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-05-11 09:35 -------
Mainline now has

void foo(const Flag&) (f)
{
  const bool D.1718;
  int D.1717;
  struct Flag * const this;
  const bool D.1713;
  int D.1712;
  struct Flag * const this;
  bool D.1707;
  bool retval.1;
  bool D.1705;
  bool retval.0;
  int D.1716;
  int D.1711;

<bb 0>:
  if (f->flag != 0) goto <L1>; else goto <L5>;

<L1>:;
  bar ();
  if (f->flag != 0) goto <L4>; else goto <L5>;

<L4>:;
  bar () [tail call];

<L5>:;
  return;

}


I.e. the missing jump threading is done, but still f->flag is seen as
possibly clobbered by the call to bar().  Still a language lawyer has
to sneak in and tell this optimization would be indeed valid.  The key
is privateness or constness of Flag::flag.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19507


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