------- Comment #21 from rguenth at gcc dot gnu dot org 2010-01-16 20:30 ------- (In reply to comment #20) > It obviously could do the same. It all depends on the answer to this > question: > Do we want to deal with this via canonicalization of expressions, and if > yes, then also on the outcome of our discussion of where that should happen > (fold or special code in VN dealing with just value numbers). > If no, then something like your patch can be done. > > In this case I'm leaning towards Paolo (comment #14), we possibly might want > to canonicalize towards fewer constants (hence towards positive constants), > when otherwise the number of operations remains the same (hence treating > PLUS_EXPR and MINUS_EXPR as equivalent).
Yes, that sounds reasonable. Note that most existing foldings only look for PLUS_EXPR once the 2nd operand is a constant, so auditing of them is required. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19988