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: [tree-ssa] Removing useless/redundant "const" calls


In message <wvlbrx3en88.fsf@prospero.boston.redhat.com>, Jason Merrill writes:
 >On Thu, 12 Jun 2003 01:31:20 -0600, law@redhat.com wrote:
 >
 >> In message <Pine.LNX.4.44.0306120921320.4105-100000@wotan.suse.de>, Michael
 > Mat
 >> z writes:
 >>  >Hi,
 >>  >
 >>  >On Thu, 12 Jun 2003 law@redhat.com wrote:
 >>  >> If the answer is no, then we'll need to distinguish between pure and
 >>  >> const functions later -- simply clearing TREE_SIDE_EFFECTS would result
 >>  >> in incorrect code.
 >>  >
 >>  >I see.  But I guess this can be done?
 >> Certainly.  It wouldn't be terribly hard.  First we clear TREE_SIDE_EFFECTS
 >> for "pure" functions.  Then we change this code in tree-ssa.c:
 >>
 >>   /* Step 2.  Check for redundant computations.  Do this optimization only
 >>      for assignments that make no calls and have no aliased stores
 >>      nor volatile references and no side effects (i.e., no VDEFs).  */
 >>   may_optimize_p = !ann->makes_aliased_stores
 >>                    && !ann->has_volatile_ops
 >>                    && vdefs == NULL
 >>                    && def_p
 >>                    && ! TREE_SIDE_EFFECTS (TREE_OPERAND (stmt, 1));
 >>                                                                            
 >   
 >> to reject 'pure' functions.  
 >
 >Seems to me the right way to model this would be to give the call a VUSE of
 >global memory (and the targets of any pointer ops).  Calls to pure
 >functions can still be made redundant so long as there isn't an aliasing
 >store between them.
Yes.  You're right for redundant calls to pure functions.  It may even
be the case that the vops are already in place to do this.

This rathole keeps getting deeper.

Jeff


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