This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Coalescing/killing redundant labels?
- From: law at redhat dot com
- To: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 16 Jul 2003 17:19:14 -0600
- Subject: Re: [tree-ssa] Coalescing/killing redundant labels?
- Reply-to: law at redhat dot com
In message <1058396499.2837.25.camel@steven.lr-s.tudelft.nl>, Steven Bosscher w
rites:
>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??
I've got some changes here which will kill unused labels during the
remove_useless_stmts_and_vars pass.
I haven't benchmarked to see if the reduction in trees we have to
expand is worth the bookkeeping work. It was really quick and
dirty (used/not-used rather than reference counting).
Also note that policy has been that user labels are never removed.
So the label removal code only removed compiler-generated labels.
If you're interested, I can probably provide some diffs... I probably
won't get back to it for a while since I'm buried in trying to
effectively make cse1's path following code pointless.
Jeff