https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95034

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For
int
combine (int a, int b)
{
  return (a | b) & ~(a & b);
}
we do optimize it, for the ||s and &&s the problem is that it is split accross
multiple basic blocks, so match.pd is out of the picture, but on the other side
reassoc which can handle conditions split across multiple bbs will handle only
a single truth operation (so the && in this case) and so we'd need to look
through the |s from there manually.

Ah, an option could be to add some truth_{and,ior,*} rules in match.pd, limited
to GENERIC probably, as it won't trigger afterwards.
But of course that would handle only the above testcase and not e.g.
    bool t1 = a || b;
    bool t2 = !(a && b);
    return t1 && t2;
etc.

Richard, any ideas?

Reply via email to