public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113186] New: [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
@ 2023-12-31 21:07 pinskia at gcc dot gnu.org
  2023-12-31 21:07 ` [Bug tree-optimization/113186] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-31 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113186
           Summary: [13/14 Regression] `(a^c) & (a^!c)` is not optimized
                    to 0 for bool
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
bool f(bool a, bool c)
{
  bool b = (a^c);
  bool d = (a^!c);
  return b & d;
}
```
This should optimize to 0 but does not since GCC 13. With the C++ front-end, I
suspect since r13-1779-g375668e0508fbe . With the C front-end, it started on
the trunk.

For C have in forwprop1:
  b_7 = a_5(D) ^ c_6(D);
  _11 = a_5(D) ^ c_6(D);
  _12 = a_5(D) == c_6(D);
  _13 = b_7 & _12;

For C++ we have (at -O1):
  b_7 = a_5(D) != c_6(D);
  _1 = ~c_6(D);
  d_8 = _1 != a_5(D);
  _11 = b_7 & d_8;

For C++ at -O2 in forwprop2, we have similar as what with the C front-end.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-04 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-31 21:07 [Bug tree-optimization/113186] New: [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool pinskia at gcc dot gnu.org
2023-12-31 21:07 ` [Bug tree-optimization/113186] " pinskia at gcc dot gnu.org
2023-12-31 21:15 ` pinskia at gcc dot gnu.org
2024-01-01  0:49 ` pinskia at gcc dot gnu.org
2024-01-01  4:04 ` pinskia at gcc dot gnu.org
2024-01-04 20:52 ` cvs-commit at gcc dot gnu.org
2024-01-04 20:52 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).