This is the mail archive of the gcc-patches@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: [patch] Lno branch merge part 3 -- ssa form updating improvements


Hello,

> > this patch adds a possibility to handle ssa form updating without need
> > to rewrite variables out of ssa form.  The idea is to allow to violate
> > the invariants of the ssa form temporarily and let a single ssa name
> > have several definitions.  A call to rewrite_ssa_into_ssa (running
> > standard ssa creation algorithm just over those ssa names) then
> > "repairs" the ssa form.
> > 
> This description doesn't look like a good idea.

do you have a better one?  The only other way I see is incremental
updating, which would be harder to both implement and use.

> But it's too brief to
> really figure out what you are trying to do.  Could you elaborate?  Will
> you make existing SSA_NAMEs disappear when you repair multiple
> definitions?

yes, although it would be relatively easy to avoid (the reason I did not
do it is that you would need to somehow tell which of the definitions is
"primary" one, which sometimes does not make much sense).

> The fact that we have the program in an invalid SSA form, however
> briefly, across two different modules

We do not; this is purely for usage inside optimization passes.

> seems like a recipe for disaster. 

Why?

> Could you describe what you are trying to do with an example?  (don't
> point me to the patch, please).

OK, let's take the loop header copying example:

start:
  x_1 = phi(x_0, x_2);
  if (x_1 > 100)
    goto end;
  x_2 = foo (x_1);
  goto start;
end:;

What we do now is that we rewrite x out of ssa form, copy the header and
rewrite it back to ssa.  The drawbacks are that we lose aliasing
information and that we are inserting unnecessary assignments on places
completely unrelated to the loop.

With the patch, we just copy the header, obtaining

L0:
  x_1 = phi (x_0)
  if (x_1 > 100)
    goto end;

L1:
  x_2 = foo (x_1);

start:
  x_1 = phi (x_2);
  if (x_1 > 100)
    goto end;
  goto L1;
end:;

x_1 now has multiple definitions.  Now the call to rewrite_ssa_into_ssa
creates the new versions for it and the neccesary phi node at L1.

Zdenek


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