[llvm] [InstCombine] Loosen one-use restriction if common operand is constant (PR #79767)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 28 12:41:02 PST 2024


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 6d7c8a6e062a237f1a23e7753c6737f5796e5188 cb8422d306bc8b577764858945ce53c477e5e34b -- llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index c72f3dfd4c..bcdc92fa44 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -4757,7 +4757,7 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
 
   // (A | B) ^ (A | C) --> (B ^ C) & ~A -- There are 4 commuted variants.
   if (match(Op0, m_c_Or(m_Value(A), m_Value(B))) &&
-      match(Op1, m_c_Or(m_Specific(A), m_Value(C)))) {  
+      match(Op1, m_c_Or(m_Specific(A), m_Value(C)))) {
     // Allow the tranformation to happen if A is one use or a constant.
     if (A->hasOneUse() || match(A, m_ImmConstant())) {
       return BinaryOperator::CreateAnd(Builder.CreateXor(B, C),

``````````

</details>


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


More information about the llvm-commits mailing list