[llvm] [InstSimplify] Simplify select if it combinated `and/or/xor` (PR #73362)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 8 23:46:00 PST 2024
================
@@ -4585,6 +4585,57 @@ static Value *simplifySelectWithFakeICmpEq(Value *CmpLHS, Value *CmpRHS,
Pred == ICmpInst::ICMP_EQ);
}
+/// Try to simplify the Select instruction consisting of add/or/xor.
+static Value *simplifySpecificBitOp(Value *CmpLHS, Value *CmpRHS,
+ Value *TrueVal, Value *FalseVal) {
+ Value *X, *Y;
+ // (X & Y) == 0 ? X | Y : X ^ Y --> X ^ Y
+ // (X & Y) == 0 ? X ^ Y : X | Y --> X | Y
+ // (X & Y) != 0 ? X | Y : X ^ Y --> X | Y
+ // (X & Y) != 0 ? X ^ Y : X | Y --> X ^ Y
----------------
dtcxzyw wrote:
```suggestion
// (X & Y) == 0 ? X | Y : X ^ Y --> X ^ Y
// (X & Y) == 0 ? X ^ Y : X | Y --> X | Y
```
Remove the misleading comments.
https://github.com/llvm/llvm-project/pull/73362
More information about the llvm-commits
mailing list