[llvm] [InstSimplify] Simplify select if it combinated `and/or/xor` (PR #73362)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 11:06:11 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1e1e11a4d7c57028953a23deae622acab5eee9ff f0abaf4dbcf8eed140a90a5e6b57c542f20a23cd -- llvm/lib/Analysis/InstructionSimplify.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index d3c7592d36..cbe13cdc9e 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4441,8 +4441,7 @@ static Value *simplifySelectBitTestSpec(Value *CmpLHS, Value *CmpRHS,
   // (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
-  if (match(CmpLHS, m_And(m_Value(X), m_Value(Y))) &&
-      match(CmpRHS, m_Zero())) {
+  if (match(CmpLHS, m_And(m_Value(X), m_Value(Y))) && match(CmpRHS, m_Zero())) {
     if (match(TrueVal, m_c_Or(m_Specific(X), m_Specific(Y))) &&
         match(FalseVal, m_c_Xor(m_Specific(X), m_Specific(Y)))) {
       return FalseVal;
@@ -4455,8 +4454,7 @@ static Value *simplifySelectBitTestSpec(Value *CmpLHS, Value *CmpRHS,
   // (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
-  if (match(CmpLHS, m_Or(m_Value(X), m_Value(Y))) &&
-      match(CmpRHS, m_Zero())) {
+  if (match(CmpLHS, m_Or(m_Value(X), m_Value(Y))) && match(CmpRHS, m_Zero())) {
     if (match(TrueVal, m_c_And(m_Specific(X), m_Specific(Y))) &&
         match(FalseVal, m_c_Xor(m_Specific(X), m_Specific(Y)))) {
       return FalseVal;

``````````

</details>


https://github.com/llvm/llvm-project/pull/73362


More information about the llvm-commits mailing list