public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114712] New: Missed optimization: simplify if-else basic blocks that share common destinations
@ 2024-04-13 18:19 xxs_chy at outlook dot com
2024-04-13 18:25 ` [Bug tree-optimization/114712] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: xxs_chy at outlook dot com @ 2024-04-13 18:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114712
Bug ID: 114712
Summary: Missed optimization: simplify if-else basic blocks
that share common destinations
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/hY6Eaj8fj
```
void dummy();
void dummy1();
void src(bool c1, bool c2){
if(c1) {
if(c2)
goto bb1;
else
goto bb2;
} else {
if(c2)
goto bb2;
else
goto bb1;
}
bb1:
dummy();
return;
bb2:
dummy1();
return;
}
```
can be folded to:
```
void tgt(bool c1, bool c2){
if (c1 ^ c2) {
dummy1();
} else {
dummy();
}
}
```
It saves unnecessary branches.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/114712] Missed optimization: simplify if-else basic blocks that share common destinations
2024-04-13 18:19 [Bug tree-optimization/114712] New: Missed optimization: simplify if-else basic blocks that share common destinations xxs_chy at outlook dot com
@ 2024-04-13 18:25 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 18:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114712
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |pinskia at gcc dot gnu.org
Ever confirmed|0 |1
Severity|normal |enhancement
Last reconfirmed| |2024-04-13
Keywords| |missed-optimization
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. ifcombine would be the perfect location for this.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-13 18:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-13 18:19 [Bug tree-optimization/114712] New: Missed optimization: simplify if-else basic blocks that share common destinations xxs_chy at outlook dot com
2024-04-13 18:25 ` [Bug tree-optimization/114712] " 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).