public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115035] New: Missed optimization: fold min/max in phi
@ 2024-05-10 15:08 xxs_chy at outlook dot com
2024-05-18 19:52 ` [Bug tree-optimization/115035] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: xxs_chy at outlook dot com @ 2024-05-10 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115035
Bug ID: 115035
Summary: Missed optimization: fold min/max in phi
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/o489f6sj5
```
bool src(unsigned a, unsigned b, bool c) {
unsigned phi;
if(c) {
dummy();
phi = a < 6 ? a : 6;
} else {
phi = b;
}
return phi < 6;
}
```
can be folded to:
```
bool tgt(unsigned a, unsigned b, bool c) {
unsigned phi;
if(c) {
dummy();
phi = a;
} else {
phi = b;
}
return phi < 6;
}
```
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/115035] Missed optimization: fold min/max in phi
2024-05-10 15:08 [Bug tree-optimization/115035] New: Missed optimization: fold min/max in phi xxs_chy at outlook dot com
@ 2024-05-18 19:52 ` pinskia at gcc dot gnu.org
2024-05-18 19:57 ` pinskia at gcc dot gnu.org
2024-05-23 12:21 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 19:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115035
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/115035] Missed optimization: fold min/max in phi
2024-05-10 15:08 [Bug tree-optimization/115035] New: Missed optimization: fold min/max in phi xxs_chy at outlook dot com
2024-05-18 19:52 ` [Bug tree-optimization/115035] " pinskia at gcc dot gnu.org
@ 2024-05-18 19:57 ` pinskia at gcc dot gnu.org
2024-05-23 12:21 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 19:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115035
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-05-18
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. GCC does have some code that handles some of this in phiopt but not
in a generic way.
Jump threading can handle:
```
int src1(unsigned a, unsigned b, int c) {
unsigned phi;
if(c) {
dummy();
phi = a < 5 ? a : 5;
} else {
phi = b;
}
if (phi < 6)
dummy();
}
```
But not:
```
int src(unsigned a, unsigned b, int c) {
unsigned phi;
if(c) {
dummy();
phi = a < 5 ? a : 5;
} else {
phi = b;
}
return (phi < 6);
dummy();
}
```
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/115035] Missed optimization: fold min/max in phi
2024-05-10 15:08 [Bug tree-optimization/115035] New: Missed optimization: fold min/max in phi xxs_chy at outlook dot com
2024-05-18 19:52 ` [Bug tree-optimization/115035] " pinskia at gcc dot gnu.org
2024-05-18 19:57 ` pinskia at gcc dot gnu.org
@ 2024-05-23 12:21 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-23 12:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115035
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 114273 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-23 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10 15:08 [Bug tree-optimization/115035] New: Missed optimization: fold min/max in phi xxs_chy at outlook dot com
2024-05-18 19:52 ` [Bug tree-optimization/115035] " pinskia at gcc dot gnu.org
2024-05-18 19:57 ` pinskia at gcc dot gnu.org
2024-05-23 12:21 ` 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).