[PATCH] D158983: [InstCombine] Fold two select patterns into or-and
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 28 11:19:13 PDT 2023
nikic added a comment.
This looks reasonable to me, can you pleas precommit the tests?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3093
+ // select (c & ~b), a, b -> select b, true, (select c, a, false)
+ if (match(CondVal, m_c_And(m_Value(C), m_Not(m_Specific(FalseVal)))) &&
+ CondVal->hasOneUse()) {
----------------
goldstein.w.n wrote:
> Instead of matching `m_Not` imo should match `m_Specific` and then check `isFreeToInvert` and generate `CreateNot` if that is the case.
I don't get what you're suggesting here. isFreeToInvert doesn't tell you how inverted values are related, which is important here. (We need ~b and b, just being invertible is not enough.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158983/new/
https://reviews.llvm.org/D158983
More information about the llvm-commits
mailing list