[llvm] [HashRecognize] Recognize trunc-to-i1 little-endian bit check (PR #213883)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 02:31:25 PDT 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 cpp -- llvm/lib/Analysis/HashRecognize.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/Analysis/HashRecognize.cpp b/llvm/lib/Analysis/HashRecognize.cpp
index 66fe1a850..ff85132d2 100644
--- a/llvm/lib/Analysis/HashRecognize.cpp
+++ b/llvm/lib/Analysis/HashRecognize.cpp
@@ -181,9 +181,8 @@ isSignificantBitCheckWellFormed(const RecurrenceInfo &ConditionalRecurrence,
       m_c_Xor(m_ZExtOrTruncOrSelf(m_Specific(ConditionalRecurrence.Phi)),
               m_ZExtOrTruncOrSelf(m_Specific(SimpleRecurrence.Phi))));
   BinaryOperator *BitShift = ConditionalRecurrence.BO;
-  if (!IsBigEndian &&
-      match(SI, m_Select(m_Trunc(m_Value(L)), m_Instruction(TV),
-                         m_Instruction(FV))))
+  if (!IsBigEndian && match(SI, m_Select(m_Trunc(m_Value(L)), m_Instruction(TV),
+                                         m_Instruction(FV))))
     return match(L, MatchPred) && FV == BitShift &&
            match(TV, m_c_Xor(m_Specific(BitShift),
                              m_SpecificInt(*ConditionalRecurrence.ExtraConst)));
@@ -309,9 +308,8 @@ bool RecurrenceInfo::matchConditionalRecurrence(
   Value *FoundStart = Phi->getIncomingValue(!LatchIdx);
 
   Instruction *TV, *FV;
-  if (!match(FoundStep,
-             m_Select(m_CombineOr(m_Cmp(), m_Trunc(m_Value())),
-                      m_Instruction(TV), m_Instruction(FV))))
+  if (!match(FoundStep, m_Select(m_CombineOr(m_Cmp(), m_Trunc(m_Value())),
+                                 m_Instruction(TV), m_Instruction(FV))))
     return false;
 
   // For a conditional recurrence, both the true and false values of the

``````````

</details>


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


More information about the llvm-commits mailing list