[llvm] [HashRecognize] Recognize trunc-to-i1 little-endian bit check (PR #213883)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 14:12:41 PDT 2026
================
@@ -172,16 +173,23 @@ 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 = match_fn(m_c_Xor(
+ m_Specific(BitShift), m_SpecificInt(*ConditionalRecurrence.ExtraConst)));
+ if (!IsBigEndian && match(SI, m_Select(m_Trunc(m_Value(L)), m_Instruction(TV),
+ m_Instruction(FV))))
+ return match(L, MatchPred) && FV == BitShift && MatchBitShiftXorGenPoly(TV);
----------------
artagnon wrote:
```suggestion
m_Instruction(FV, m_Specific(BitShift)))))
return match(L, MatchPred) && MatchBitShiftXorGenPoly(TV);
```
https://github.com/llvm/llvm-project/pull/213883
More information about the llvm-commits
mailing list