Displaying 3 results from an estimated 3 matches for "m_c_and".
2017 Jul 13
2
failing to optimize boolean ops on cmps
...----------------------
Would adding to the existing InstCombine logic folds to handle this kind of
pattern be a welcome enhancement? I don't know if it's possible to make the
matchers handle this case without adding a new matcher. Eg:
// ((~A & B) | A) -> (A | B)
if (match(Op0, m_c_And(m_Not(m_Specific(Op1)), m_Value(A))))
return BinaryOperator::CreateOr(A, Op1);
Is there a way to make "m_Not(m_Specific())" match an inverted compare?
This optimization hole can manifest in strange ways:
https://godbolt.org/g/gjpAVo
We got it right for C++, but C managed to fall th...
2017 Jul 13
2
failing to optimize boolean ops on cmps
...matchers handle this case without adding a new matcher. Eg:
>>
>>
> I would rather see this added to instsimplify than instcombine.
> If you do that, GVN/et all will get this already.
>
> This probably does require a special matcher though:
>
>
> We have:
> if (m_c_And(m_Cmp(Pred, m_Value(), m_Value()),
> m_Cmp(Pred, m_Value(), m_Value()))
>
> and you really want:
> if (m_c_And(m_Cmp(Pred, m_Value(), m_Value()),
> m_Cmp(m_Opposite(Pred), m_Value(), m_Value()))
>
>
>
>
-------------- next part --------------...
2017 Jul 14
2
failing to optimize boolean ops on cmps
...ut adding a new matcher. Eg:
>
>
> I would rather see this added to instsimplify than instcombine.
> If you do that, GVN/et all will get this already.
>
> This probably does require a special matcher though:
>
>
> We have:
> if (m_c_And(m_Cmp(Pred, m_Value(), m_Value()),
> m_Cmp(Pred, m_Value(), m_Value()))
>
> and you really want:
> if (m_c_And(m_Cmp(Pred, m_Value(), m_Value()),
> m_Cmp(m_Opposite(Pred), m_Value(), m_Value()))
>
>
>
>
>
>
>
> __...