public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114702] New: Missed optimization: fail to infer c - b != if a + b != c
@ 2024-04-12 13:50 xxs_chy at outlook dot com
  2024-04-12 22:33 ` [Bug tree-optimization/114702] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: xxs_chy at outlook dot com @ 2024-04-12 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114702
           Summary: Missed optimization: fail to infer c - b != if a + b
                    != c
           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/58rxGaabW

```
void src(int a, int b){
    if(b + a == 32){
        return;
    }else{
        if(32 - b == a)
            dummy();
        else
            dummy1();
    }
}
```

Obviously, "32 - b == a" is false. We can get:

```
void tgt(int a, int b){
    if(b + a == 32){
        return;
    }else{
        dummy1();
    }
}
```


This is a real-world dead code after inlining functions in QEMU.

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

end of thread, other threads:[~2024-04-12 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 13:50 [Bug tree-optimization/114702] New: Missed optimization: fail to infer c - b != if a + b != c xxs_chy at outlook dot com
2024-04-12 22:33 ` [Bug tree-optimization/114702] " 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).