On 10/06/2016 01:18 AM, Richard Biener wrote:

It ought to be easy to fold x ^ y to zero when x == y (famous last words).
I'm sure I'll regret saying that when I go to look at how to twiddle DOM
appropriately.

Interesting idea.  Though it get's (theoretically) interesting for
ternary ops where you'd need to try 6 variants then ... thus in the
end it's a hack ...
I was actually pondering folding as changes are made rather than at the end of processing the current statement. So given x ^ y and an x == y equivalence in the tables. We'll replace one operand resulting in x ^ x or y ^ y, and immediately fold it to zero.

My suspicion is that most of time cprop doesn't change the current statement and that multiple propagations into the current statement are even rarer. So for the two most common cases (0 or 1 operand can be propagated in the current statement) there would be zero additional cost.



That said, having SSA_NAME_VALUE (SSA_NAME_VALUE (t)) == t looks like
a bug in the lattice to me.
Not really. It's just a convenient place to record the two way equivalence. Even if we had a different, cleaner way to record the two-way equivalence the core issues around this BZ would remain.

jeff

Reply via email to