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

Diego Novillo dnovillo@redhat.com
Tue Feb 25 16:51:00 GMT 2003


On Tue, 2003-02-25 at 11:23, law@redhat.com wrote:
> In message <1046189535.1695.11.camel@shadowfax>, Diego Novillo writes:
>  >On Tue, 2003-02-25 at 11:10, law@redhat.com wrote:
>  >> In message <20030225155039.GB746@tornado.toronto.redhat.com>, Diego Novillo
>  > wri
>  >> tes:
>  >>
>  >>  >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.
>  >> 
>  >But Jeff, as I mentioned in my previous post, if ccp_fold() is not able
>  >to fold an expression that is indeed CONSTANT, we will consider it
>  >VARYING and will then block further propagation (e.g., '1 && 1').  We
>  >must avoid that.
> Yes, and those should be rare.  Very very rare.
>
Not handling && was most certainly *not* rare.  Ditto builtins.  The
check didn't catch any other cases, but we are dying in stage2, so I
don't know if there are other cases missing.

> If there are important cases missing, then we can add them, but the minute
> you start requiring that the two folders always give the same result
> you're going down a rathole.
> 
Well, that tells me we have a design problem in fold() then.  We really
need to have a nondestructive folder that behaves exactly the same as
the destructive one.  Otherwise, we'll make CCP do stupid things.

Or, if as you point out, the two variants of fold can't really be made
to share more code, we will then have to bite the bullet and go down the
rathole anyway.


Diego.



More information about the Gcc mailing list