Fixed: https://github.com/llvm/llvm-project/issues/62113
Add addtional check in visitSelectInst to:
- match select(X|Y==0, X, X|Y) and replaced with X|Y
- match select(X&Y==-1, X, X&Y) and replaced with X&Y
alive proof:
https://alive2.llvm.org/ce/z/4qHmv-
https://alive2.llvm.org/ce/z/c2MBGy
If the cmp LHS is FalseVal, pred should be ne here.
If the cmp LHS is TrueVal, pred should be eq I guess.