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

Vito Kortbeek via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 02:28:54 PDT 2026


================
@@ -172,16 +173,26 @@ isSignificantBitCheckWellFormed(const RecurrenceInfo &ConditionalRecurrence,
   const Value *L;
   const APInt *R;
   Instruction *TV, *FV;
-  if (!match(SI, m_Select(m_ICmp(Pred, m_Value(L), m_APInt(R)),
-                          m_Instruction(TV), m_Instruction(FV))))
-    return false;
 
   // Match predicate with or without a SimpleRecurrence (the corresponding data
   // is LHSAux).
   auto MatchPred = m_CombineOr(
       m_Specific(ConditionalRecurrence.Phi),
       m_c_Xor(m_ZExtOrTruncOrSelf(m_Specific(ConditionalRecurrence.Phi)),
               m_ZExtOrTruncOrSelf(m_Specific(SimpleRecurrence.Phi))));
+  BinaryOperator *BitShift = ConditionalRecurrence.BO;
+  auto MatchBitShiftXorGenPoly = [&](const Value *V) {
+    return match(V, m_c_Xor(m_Specific(BitShift),
+                            m_SpecificInt(*ConditionalRecurrence.ExtraConst)));
+  };
----------------
vkortbeek-gf wrote:

Thanks! Fixed. I didn't know this existed.

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


More information about the llvm-commits mailing list