[PATCH]: Fix latent bug in tailcall
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Wed Feb 1 14:51:00 GMT 2006
Hello,
> >>>> Daniel Berlin wrote:
> >>>>> This patch fixes a latent bug in tree-tailcall where it did not update
> >>>>> the virtual ssa form for non-call clobbered virtual operands, even
> >>>> when
> >>>>> there were live on entry virtual operands that needed updating.
> >>>> Just to be thorough for Diego (and the list)'s, you *could* do this
> >>>> without calling update_ssa, but the algorithm used is the same:
> >>>>
> >>>> For each virtual definition that has a live on entry operand
> >>>> 1. Find the definition that will now reach the entry block
> >>>> and a dd this definition as a phi argument.
> >>>> 2. Add the live on entry definition as the other phi argument
> >>>> 3. Replace all uses to use the phi node.
> >>>>
> >>>> I tried implementing this, and it ends up being no faster than calling
> >>>> the virtuals-only update, so ......
> >>> the additional problem with this algorithm is that it does not work --
> >>> in particular in step 1, such definition does not have to be unique.
> >> There will be as many definitions as there are predecessors of the block
> >> that is the continuation of the loop.
> >> What makes you think there will be more?
> >>
> >>> So you would need to create phi nodes inside the function body and
> >>> end up with standard ssa update algorithm anyway.
> >> I disbelieve that you will end up creating phi nodes anywhere but the
> >> block you've made the top of the loop.
> >
> > for example (see the block <L3>):
> >
>
> Oh, you mean the cases where we've elided the phi nodes originally
> because we pruned them (using liveness), since they had no uses.
>
> That's simply a matter of specifying that tailcall wants full ssa form,
> instead of pruned, semi-pruned, or minimal.
anyway, it means either running ssa update, or preserving full ssa form
(which we did not do for quite some time, so it would probably require
some changes to other parts of gcc).
Zdenek
More information about the Gcc-patches
mailing list