[llvm] [HashRecognize] Recognize trunc-to-i1 little-endian bit check (PR #213883)
Vito Kortbeek via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 04:18:14 PDT 2026
================
@@ -172,16 +173,24 @@ 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)),
----------------
vkortbeek-gf wrote:
I don't think that would help, but I might be missing something.
`m_SelectLike` would match `zext/sext(i1 %cond)` or `select`
But here we have:
```llvm
%cond = trunc i8 %x to i1
%next = select i1 %cond, i16 %with.poly, i16 %shift
```
Did you mean `m_ICmpLike`? That one seems to handle `trunc nuw X to i1`, equivalent to `icmp ne i8 %x, 0`, but we get a plain `trunc X to i1` equivalent to `icmp ne (and X, 1), 0`, so we miss the `nuw` flag.
Let me know if you had something else in mind.
https://github.com/llvm/llvm-project/pull/213883
More information about the llvm-commits
mailing list