On Thu, 6 Nov 2014, Marc Glisse wrote: > On Thu, 6 Nov 2014, Richard Biener wrote: > > > +/* Simplify (A & B) OP0 (C & B) to (A OP0 C) & B. */ > > > +/* (x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2) */ > > As soon as there are 2+ operations in the result, this comment in > fwprop_ssa_val becomes outdated, no?
Yes, but in the above case the 2nd operand of the outer | folds to a constant, thus the whole expression only uses a single SSA name. Btw, I was careful to only convert patterns from tree-ssa-forwprop.c that do not care about the number of uses (if you look there are not many that do - mainly all the comparison simplification) > /* We continue matching along SSA use-def edges for SSA names > that are not single-use. Currently there are no patterns > that would cause any issues with that. */ > > (I am not opposing the patch, just trying to understand how things work for > when I'll propose new patterns) If it's entirely new patterns and the pattern is a simplification I wouldn't care about single-uses. CSE is supposed to fix things up for us. Exceptions may apply if for example the operation we transform to is more expensive than the two we combine it from. But well - apply common sense. I am currently trying to make us not regress ;) (I don't expect to get to replace the comparison simplification tree-ssa-forwprop.c does with patterns as fold_comparison and friends has so many transforms with "interesting" implementations - not during this stage1 at least) Richard.