I'm removing the patterns entirely here, as they are not correct in the general case, but maybe they still can/need to be salvaged for more specific cases. I'm not sure whether or not the code that was previously generated for non-zeroext i1 params was correct -- I couldn't find information on what the semantics of an i1 parameter without zeroext/signext is. My guess is that it is anyext by default, which means that the explicit masking is necessary there for correctness.
Thanks for tracking that down. You’re totally right that the pattern was wrong generally, although it still applies to legalized i1s. Since we don’t have access to legalization history in selection dags, I think we will want to reintroduce this optimization more selectively in WebAssemblyISelDAGLowering.
Feel free to commit this, or let me know if you don’t have commit privileges and I can land it for you.