[tree-ssa] CCP and non-destructive folding problems

law@redhat.com law@redhat.com
Tue Feb 25 16:00:00 GMT 2003


In message <20030225152722.GA32721@tornado.toronto.redhat.com>, Diego Novillo w
rites:
 >Oops.  This means that:
 >
 >(a) evaluate_stmt() has to be careful when returning UNDEFINED.
 >    The optimistic evaluation of PHI nodes may cause problems
 >    like the one above.  I fixed this particular one by copying
 >    more code from the destructive folder into the
 >    non-destructive folder.
Copying or better yet sharing code between the folders is a good thing.


 >(b) The non-destructive and destructive folders must always
 >    return the same values.  I've added a (moderately expensive)
 >    check for this in the final fold pass.
No.  They do not.  This is wrong.  

The check is mildly interesting in that it can point out places where
the non-destructive folder could be optimizing, but if we have a
requirement that they return the same results, then something is
wrong elsewhere (as I pointed out in my last message).


 >I don't like the direction where this is taking us.  We have two
 >different implementations of fold() with quite a bit of code
 >duplication.  It's a maintenance problem.  We *really* need to
 >sit down and re-design fold().  We have three parameters:
There actually is very little code duplicated.  Look closely.  Yes,
they both have a big switch statement and a little prep code.  But
the code for each of the cases is mostly disjoint.

 >It may make sense to write fold() in terms of the non-destructive
 >fold.  Jeff, do you have anything in mind regarding this problem?
I think if you go down this path you're going to find that:

  1. It's bloody hard.

  2. It'll be bloody expensive, particularly for all the code that
     doesn't need the non-destructive behavior.


jeff




More information about the Gcc mailing list