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] Some operands building cleanups


Hello,

> > > > -- finalize_ssa_def_ops and finalize_ssa_use_ops compare pointers that
> > > >    do not belong to the same object by <, which is undefined.  However,
> > > >    since the real operand lists are not sorted anyway, this is
> > > >    unnecessary.
> > > 
> > > They are sorted so we can avoid a doubly nested loop.
> > 
> > no, they are not sorted.  append_{def,use} just collects them into
> > build_{defs,uses} list in the order they are found, and the lists are
> > never sorted.  Only the lists of virtual operands are sorted.
> > 
> 
> Then its a latent bug and should be fixed. 

is it really a bug? There are basically two cases regarding what might
have happened with the statement:

1) SSA name was replaced by another SSA name.  Then everything works
   just fine, as number and the order of the operands did not change.
2) There was a more complicated change (like ssa name being replaced by
   a constant, or something even more complex).  In this case, we most
   likely called fold_stmt on the statement, thus possibly modifying it
   in almost arbitrary way, and relying on that old defs/uses are preserved
   is simply wrong.

Also, the patch passes bootstrap & regtesting, and it does not really
change the current semantics in any significant way, so there probably
are no optimizations that would have problems with that (and if they
appear, it will probably be more profitable to fix the optimizations
than to slow down operand building).

Zdenek


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