public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114774] New: Missed DSE in simple code
@ 2024-04-18 18:26 hubicka at gcc dot gnu.org
  2024-04-18 18:29 ` [Bug middle-end/114774] Missed DSE in simple code due to other stores being conditional pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hubicka at gcc dot gnu.org @ 2024-04-18 18:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114774
           Summary: Missed DSE in simple code
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

In the following

#include <stdio.h>
int a;
short *p;
void
test (int b)
{
        a=1;
        if (b)
        {
                (*p)++;
                a=2;
                printf ("1\n");
        }
        else 
        {
                (*p)++;
                a=3;
                printf ("2\n");
        }
}

We are not able to optimize out "a=1". This is simplified real-world scenario
where SRA does not remove definition of SRAed variables.

Note that clang does conditional move here
test:                                   # @test
        .cfi_startproc
# %bb.0:
        movq    p(%rip), %rax
        incw    (%rax)
        xorl    %eax, %eax
        testl   %edi, %edi
        leaq    .Lstr(%rip), %rcx
        leaq    .Lstr.2(%rip), %rdi
        cmoveq  %rcx, %rdi
        sete    %al
        orl     $2, %eax
        movl    %eax, a(%rip)
        jmp     puts@PLT                        # TAILCALL

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

end of thread, other threads:[~2024-05-16  9:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 18:26 [Bug middle-end/114774] New: Missed DSE in simple code hubicka at gcc dot gnu.org
2024-04-18 18:29 ` [Bug middle-end/114774] Missed DSE in simple code due to other stores being conditional pinskia at gcc dot gnu.org
2024-04-18 20:02 ` [Bug middle-end/114774] Missed DSE in simple code due to interleaving sotres hubicka at gcc dot gnu.org
2024-04-19  6:01 ` [Bug tree-optimization/114774] " rguenth at gcc dot gnu.org
2024-04-19  7:36 ` hubicka at ucw dot cz
2024-04-19  8:20 ` rguenther at suse dot de
2024-04-19  9:23 ` hubicka at ucw dot cz
2024-04-19 10:05 ` [Bug tree-optimization/114774] Missed DSE in simple code due to interleaving stores rguenth at gcc dot gnu.org
2024-05-16  9:04 ` cvs-commit at gcc dot gnu.org
2024-05-16  9:06 ` rguenth 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).