The previous commit to restrict the transform looks correct. If we do not check for extra uses, then the transform could create more IR instructions than we started with. We usually do not want to do that.
To restore the optimizations for patterns shown in your example code, you should probably match patterns starting from an “icmp eq 0” and create 1 or 2 logic instructions: https://alive2.llvm.org/ce/z/yzwEf9
This could be generalized for zext/sext, different logic (and/or/xor) instructions, and eq/ne predicates.