public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100864] New: (a&!b) | b is not opimized to a | b for conditionals
@ 2021-06-01 23:48 pinskia at gcc dot gnu.org
  2021-06-02  1:33 ` [Bug tree-optimization/100864] (a&!b) | b is not opimized to a | b for comparisons pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-01 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100864
           Summary: (a&!b) | b is not opimized to a | b for conditionals
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
_Bool f(int a, int b, _Bool e)
{
  _Bool c = (a > b);
  _Bool d = !c;
  return (e & d) | c;
}
--- CUT ----
We get currently:
  c_5 = a_3(D) > b_4(D);
  _2 = a_3(D) <= b_4(D);
  _1 = _2 & e_7(D);
  _6 = _1 | c_5;

But this should be optimized to just:

c_5 = a_3(D) <= b_4(D);
_6 = e_7(D) | c_5;

I noticed this while fixing PR 96923.

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

end of thread, other threads:[~2023-07-31 17:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 23:48 [Bug tree-optimization/100864] New: (a&!b) | b is not opimized to a | b for conditionals pinskia at gcc dot gnu.org
2021-06-02  1:33 ` [Bug tree-optimization/100864] (a&!b) | b is not opimized to a | b for comparisons pinskia at gcc dot gnu.org
2021-06-02  2:05 ` pinskia at gcc dot gnu.org
2021-06-02  8:09 ` rguenth at gcc dot gnu.org
2021-06-05  1:21 ` pinskia at gcc dot gnu.org
2021-06-14 22:04 ` pinskia at gcc dot gnu.org
2023-05-24  0:09 ` pinskia at gcc dot gnu.org
2023-07-22 23:28 ` pinskia at gcc dot gnu.org
2023-07-29 19:10 ` pinskia at gcc dot gnu.org
2023-07-31 17:12 ` cvs-commit at gcc dot gnu.org
2023-07-31 17:14 ` 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).