[llvm] [GlobalISel] Fold `a bitwiseop (~b +/- c)` -> `a bitwiseop ~(b -/+ c)` (PR #181725)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 16 11:20:58 PST 2026


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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index 70e755b83..1aa6ca173 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -3215,12 +3215,12 @@ bool CombinerHelper::matchBinopWithNeg(MachineInstr &MI,
     // Check if either operand is ~b
     if (mi_match(InnerLHS, MRI, m_Not(m_Reg(NotSrc)))) {
       if (!MRI.hasOneNonDBGUse(InnerLHS))
-      return false;
+        return false;
       B = NotSrc;
       C = InnerRHS;
     } else if (mi_match(InnerRHS, MRI, m_Not(m_Reg(NotSrc)))) {
       if (!MRI.hasOneNonDBGUse(InnerRHS))
-      return false;
+        return false;
       B = NotSrc;
       C = InnerLHS;
     } else {

``````````

</details>


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


More information about the llvm-commits mailing list