[Bug tree-optimization/110111] bool patterns that should produce a?b:c

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 12 06:20:41 GMT 2023


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-07-12
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I just ran into this while writing some code inside GCC even.
I originally wrote the code like:
(innereq && cst0) || (!innereq && cst1)

And then I was like that should just be `innereq ? cst0 : cst1`

The other function this should be done for is:
bool f3(bool a, bool b, bool c)
{
  return (a && b) || (!a && c);
}


More information about the Gcc-bugs mailing list