On Mon, Dec 29, 2014 at 12:14:31PM +0000, Alan Lawrence wrote: > Just a quick thought: will this catch e.g. (and (not X) (ior X Y))?
It doesn't (and nothing else does, either; I checked). > That's > equivalent to (and (not X) (ior (not (not X)) Y)), i.e. (and X' (ior (not > X') Y)) with X'=(not X), under the assumption that (not (not X)) is > equivalent to X. However I suspect for cases of this form, GET_CODE (XEXP > (op1, <n>)) != NOT...? Right. We'd have to check that in (and A (ior B C)) A is equal to the NOT of B or C. Or, we could transform it to (ior (and A B) (and A C)) and see if that simplifies to something simpler. Also for IOR and AND swapped. Dunno what other cases we miss. I'm a bit worried about the cost of a more general test, and how do you determine "what is simpler" anyway, in not-so-simple cases. Either way, my patch fixes a testsuite fail ;-) Segher