public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113433] New: [12/13/14 Regression] Missed optimization for redundancy computation elimination
@ 2024-01-17  2:55 652023330028 at smail dot nju.edu.cn
  2024-01-17  3:08 ` [Bug tree-optimization/113433] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: 652023330028 at smail dot nju.edu.cn @ 2024-01-17  2:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113433
           Summary: [12/13/14 Regression] Missed optimization for
                    redundancy computation elimination
           Product: gcc
           Version: 14.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 maybe there is a missed optimization for redundancy
computation elimination.

Different from PR 113265, This code worked as expected until GCC-12.

https://godbolt.org/z/nKh7zfsYn
int c,d,e;
void func(int y){
    c=1-y;
    d=0;
    e=c/(d+(-c));
}

GCC (trunk):
func(int):
        mov     DWORD PTR d[rip], 0
        mov     eax, 1
        sub     eax, edi
        sub     edi, 1
        cdq
        mov     DWORD PTR c[rip], eax
        idiv    edi
        mov     DWORD PTR e[rip], eax
        ret

Expected code (GCC-11.4):
func(int):
        mov     DWORD PTR d[rip], 0
        mov     eax, 1
        mov     DWORD PTR e[rip], -1
        sub     eax, edi
        mov     DWORD PTR c[rip], eax
        ret

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

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

end of thread, other threads:[~2024-05-26  5:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17  2:55 [Bug tree-optimization/113433] New: [12/13/14 Regression] Missed optimization for redundancy computation elimination 652023330028 at smail dot nju.edu.cn
2024-01-17  3:08 ` [Bug tree-optimization/113433] " pinskia at gcc dot gnu.org
2024-01-17  8:09 ` rguenth at gcc dot gnu.org
2024-03-09  4:40 ` law at gcc dot gnu.org
2024-05-26  5:43 ` [Bug tree-optimization/113433] [12/13/14/15 " pinskia at gcc dot gnu.org
2024-05-26  5:43 ` 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).