public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115004] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
@ 2024-05-09  9:06 652023330028 at smail dot nju.edu.cn
  2024-05-09 16:40 ` [Bug tree-optimization/115004] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: 652023330028 at smail dot nju.edu.cn @ 2024-05-09  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115004
           Summary: [11/12/13/14/15 Regression] Missed optimization for
                    Dead Code Elimination
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 652023330028 at smail dot nju.edu.cn
  Target Milestone: ---

Hello, we noticed that the code below can be optimized by Dead Code
Elimination, but gcc -O3 missed it.

This is a regression from GCC-8.1.

https://godbolt.org/z/7e64e56Mq

int m;
void fn(signed char p1, short p2, signed char p3_1, signed char p3_2, short p4,
unsigned char p5) {
if(
    (signed char)((p4 | 0) && (p1 || p2) || p5 || p3_1 && p5)
-
    (signed char)((p4 | 0) && (p1 || p2) || p5 || p3_2 && p5)
)
    { m=1; }
}

GCC -O3:
fn(signed char, short, signed char, signed char, short, unsigned char):
        test    r8w, r8w
        je      .L1
        test    dil, dil
        setne   al
        test    si, si
        setne   dl
        or      eax, edx
        test    r9b, r9b
        jne     .L6
.L1:
        ret
.L6:
        test    al, al
        jne     .L1
        test    r9b, r9b
        jne     .L1
        mov     DWORD PTR m[rip], 1
        ret

Expected code (GCC-7.5):
fn(signed char, short, signed char, signed char, short, unsigned char):
        rep ret

Thank you very much for your time and effort! We look forward to hearing from
you.

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

* [Bug tree-optimization/115004] [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
  2024-05-09  9:06 [Bug tree-optimization/115004] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
@ 2024-05-09 16:40 ` pinskia at gcc dot gnu.org
  2024-05-10 11:16 ` rguenth at gcc dot gnu.org
  2024-05-29  0:11 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-09 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note this works with the IR coming out of the C front-end but NOT the IR coming
out from the C++ front-end.

Yes the front-ends are different.

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

* [Bug tree-optimization/115004] [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
  2024-05-09  9:06 [Bug tree-optimization/115004] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
  2024-05-09 16:40 ` [Bug tree-optimization/115004] " pinskia at gcc dot gnu.org
@ 2024-05-10 11:16 ` rguenth at gcc dot gnu.org
  2024-05-29  0:11 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-10 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5
      Known to work|                            |8.1.0

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

* [Bug tree-optimization/115004] [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
  2024-05-09  9:06 [Bug tree-optimization/115004] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
  2024-05-09 16:40 ` [Bug tree-optimization/115004] " pinskia at gcc dot gnu.org
  2024-05-10 11:16 ` rguenth at gcc dot gnu.org
@ 2024-05-29  0:11 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-29  0:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-05-29
      Known to fail|                            |8.1.0
      Known to work|8.1.0                       |7.5.0
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Both front-ends regress in GCC 8. But it was fixed in GCC 14 when
using the C front-end.

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

end of thread, other threads:[~2024-05-29  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-09  9:06 [Bug tree-optimization/115004] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
2024-05-09 16:40 ` [Bug tree-optimization/115004] " pinskia at gcc dot gnu.org
2024-05-10 11:16 ` rguenth at gcc dot gnu.org
2024-05-29  0:11 ` 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).