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][alias-improvements] VOP safety net during early-optimizations


On Mon, 24 Nov 2008, Diego Novillo wrote:

> 2008/11/24 Richard Guenther <rguenther@suse.de>:
> 
> > This makes the virtual operands safety-net available as soon as we go
> > into SSA.  Which means we can get rid of the hack of setting volatile-ops
> > on memory statements during early optimizations.  It also means that any
> > pass should just work during early optimizations.  The only difference
> > to full alias information is the lack of points-to information (which
> > is at the moment not used at all on the branch).
> 
> Nice!  Thanks for doing ths.
> 
> 
> > ===================================================================
> > *** gcc/tree-into-ssa.c.orig    2008-11-23 20:35:41.000000000 +0100
> > --- gcc/tree-into-ssa.c 2008-11-23 22:15:45.000000000 +0100
> > *************** set_livein_block (tree var, basic_block
> > *** 585,590 ****
> > --- 585,597 ----
> >  static inline bool
> >  symbol_marked_for_renaming (tree sym)
> >  {
> > +   if (sym == gimple_vop (cfun)
> > +       && cfun->gimple_df->vop_needs_renaming)
> > +     return true;
> 
> Why treat it as a special case, though?  Why not add it to
> SYMS_TO_RENAME?  You have extra code to handle it differently in a few
> other places.  Seems unnecessary.

This is because during IPA optimizations we end up marking the vop
for renaming for different functions without calling update_ssa
inbetween.  And the update-ssa machinery is shared - so I introduced
this lame private vop_needs_renaming flag.  I tried to privatize
the syms_to_rename and related structures/bitmaps to be per-function
but failed two times - but this is still on my TODO list.

> > ===================================================================
> > *** gcc/ipa-cp.c.orig   2008-11-23 20:40:40.000000000 +0100
> > --- gcc/ipa-cp.c        2008-11-23 21:44:30.000000000 +0100
> > *************** ipcp_update_callgraph (void)
> > *** 972,977 ****
> > --- 972,981 ----
> >                gsi = gsi_for_stmt (cs->call_stmt);
> >                gsi_replace (&gsi, new_stmt, true);
> >                cgraph_set_call_stmt (cs, new_stmt);
> > +               /* ???  We loose pure/const or clobber information during
> 
> s/loose/lose/

Fixed.

> > *** gcc/tree-call-cdce.c.orig   2008-11-23 20:35:41.000000000 +0100
> > --- gcc/tree-call-cdce.c        2008-11-23 21:44:30.000000000 +0100
> > *************** tree_call_cdce (void)
> > *** 906,911 ****
> > --- 906,914 ----
> >      {
> >        free_dominance_info (CDI_DOMINATORS);
> >        free_dominance_info (CDI_POST_DOMINATORS);
> > +       /* As we introduced new control-flow we need to insert PHI-nodes
> > +          for the call-clobbers of the remaining call.  */
> > +       mark_sym_for_renaming (gimple_vop (cfun));
> 
> The comment does not really explain why we mark gimple_vop for
> renaming.

we transform

  # MEM_3 = VDEF <MEM_2>
  x_1 = sqrt (y_1);
  # VUSE <MEM_3>
  z_1 = w;

to

  if (x_1 < 0.0)
    # MEM_3 = VDEF <MEM_2>
    x_1 = sqrt (y_1);
  # VUSE <MEM_3>
  z_1 = w;

which is invalid - we need to insert a PHI node to merge MEM_3 and
MEM_2.  We didn't hit this before because call-cdce was run only
before alias computation.

Richard.


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