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

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


In message <20030225155039.GB746@tornado.toronto.redhat.com>, Diego Novillo wri
tes:
 >On Tue, 25 Feb 2003, Jeff Law wrote:
 >
 >> In message <20030225152722.GA32721@tornado.toronto.redhat.com>, Diego Novil
 >lo 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).
 >> 
 >You pointed out, but you didn't explain why this is wrong.
 >Explain please.
 >
 >How is it OK for the two versions of fold() to return different
 >values for the exact same expression?
As long as the return values will run-time evaluate to the same value,
then it is safe.  ie, it is safe for one to simplify an expression that
the other does not.

Jeff




More information about the Gcc mailing list