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]

[tree-ssa] Coalescing/killing redundant labels?


Consider this snippet:

int a, b;
 
void
foo (void)
{
  if (a)
    { a = b; goto byebye2; }
  else if (b)
    { b = a; uselesspos: goto byebye1; }
 
byebye2:
byebye1:
  return;
}

At -O2 we tree-optimize this to:
 
;; Function foo (foo)
 
foo ()
{
  void byebye2 = <<< error >>>;
  void byebye1 = <<< error >>>;
 
  if (a != 0)
    {
      a = b
    }
  else
    {
      if (b != 0)
        {
          b = a;
	  uselesspos:;;
          goto byebye1;
        }
    };
  byebye2:;;
  byebye1:;;
  return;
}

So the presence of byebye2 apparently prevents the elimination of the
`goto' statement.  Why aren't the byebyex labels coasesced?  And what
about the unused label `uselesspos'?  It doesn't matter much for the
generated code I suppose, but it gives the expanders just a little less
cruft to deal with, and also for the future post-ssa optimizers...  So
maybe it's worth it anyway.  Has anyone tried it already??

Gr.
Steven


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