On Mon, Feb 13, 2012 at 12:27:35PM -0200, Alexandre Oliva wrote: > Jakub asked to have a closer look at the problem, and I found we could > do somewhat better. The first thing I noticed was that the problem was > that, in each block that computed a (base+const), we created a new VALUE > for the expression (with the same const and global base), and a new > reverse operation.
I'm not convinced you want the > + /* Keep VALUE equivalences around. */ > + for (l = v->locs; l; l = l->next) > + if (GET_CODE (l->loc) == VALUE) > + return true; hunk in invariant_p, I'd say it should stay in preserve_only_values, a value equivalence isn't necessarily invariant. Otherwise the cselib.c changes look ok to me, but I don't understand why are you removing the var-tracking.c loop. While cselib will with your changes handle the situation better, for values that are already invariant (guess canonical_cselib_val should be called before that loop and perhaps instead of testing CONSTANT_P it could test invatiant_p if you rename it to cselib_invariant_p and export) adding any reverse ops for it is really just a waste of resources, because we have a better location already in the list. Adding the extra loc doesn't improve it in any way. Jakub