public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114737] New: Missed optimization : fail to optimize load with select clobber
@ 2024-04-16  7:55 xxs_chy at outlook dot com
  2024-04-16 10:47 ` [Bug tree-optimization/114737] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: xxs_chy at outlook dot com @ 2024-04-16  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114737
           Summary: Missed optimization : fail to optimize load with
                    select clobber
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xxs_chy at outlook dot com
  Target Milestone: ---

Godbolt link: https://godbolt.org/z/3e5sfvfKj

```
char src(void** p, char* p1, bool c) {
    char* tostore1 = p1 + 1;
    char* tostore2 = p1 + 4;
    *p = tostore1;
    *p1 = 0;

    char* tostore = (c ? tostore1 : tostore2) + 1;
    *tostore = 1;
    return *p1;
}
```

"return *p1" can be optimized into "return 0" here.

```
char tgt(void** p, char* p1, bool c) {
    char* tostore1 = p1 + 1;
    char* tostore2 = p1 + 4;
    *p = tostore1;
    *p1 = 0;

    char* tostore = (c ? tostore1 : tostore2) + 1;
    *tostore = 1;
    return 0;
}
```

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

end of thread, other threads:[~2024-04-16 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16  7:55 [Bug tree-optimization/114737] New: Missed optimization : fail to optimize load with select clobber xxs_chy at outlook dot com
2024-04-16 10:47 ` [Bug tree-optimization/114737] " 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).