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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 05:05:51 PDT 2026


================
@@ -172,16 +173,25 @@ 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 = m_c_Xor(
+      m_Specific(BitShift), m_SpecificInt(*ConditionalRecurrence.ExtraConst));
+  if (!IsBigEndian &&
+      match(SI, m_Select(m_Trunc(MatchPred), MatchBitShiftXorGenPoly,
+                         m_Specific(BitShift))))
+    return true;
----------------
artagnon wrote:

Sorry, my thinko. There wouldn't be a Pred, and there is no constant-range to get in this case: should be fine as-is.

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


More information about the llvm-commits mailing list