public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114969] New: [11/12/13/14/15 Regression] Missed optimization: (bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | ( var_0 ? 1 : 0)) => (bool) var_0
@ 2024-05-07 10:22 652023330028 at smail dot nju.edu.cn
2024-05-07 11:26 ` [Bug tree-optimization/114969] " rguenth at gcc dot gnu.org
2024-05-08 3:44 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: 652023330028 at smail dot nju.edu.cn @ 2024-05-07 10:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114969
Bug ID: 114969
Summary: [11/12/13/14/15 Regression] Missed optimization:
(bool)((std::max((unsigned long long) 0, (unsigned
long long) var_0)) | ( var_0 ? 1 : 0)) => (bool)
var_0
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: 652023330028 at smail dot nju.edu.cn
Target Milestone: ---
Hello, we noticed that the code below can be optimized as stated in the title
((bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | (
var_0 ? 1 : 0)) => (bool) var_0), but gcc -O3 seems to have missed it.
This is a regression from GCC-4.8.1.
https://godbolt.org/z/zo86Gz74r
#include <algorithm>
bool result;
void func(unsigned long long var_0) {
result = (std::max((unsigned long long) 0, (unsigned long long) var_0)) | (
var_0 ? 1 : 0);
}
GCC -O3:
<bb 2> [local count: 1073741824]:
# DEBUG BEGIN_STMT
_7 = var_0_5(D) != 0;
_8 = (long long unsigned int) _7;
_1 = var_0_5(D) | _8;
_2 = _1 != 0;
result = _2;
return;
func(unsigned long long):
xor eax, eax
test rdi, rdi
setne al
or rax, rdi
setne BYTE PTR result[rip]
ret
Expected code (GCC-4.7.4):
<bb 2>:
# DEBUG __a => &D.9143
# DEBUG __b => &D.9144
D.9181_24 = var_0_2(D) != 0;
result = D.9181_24;
return;
func(unsigned long long):
test rdi, rdi
setne BYTE PTR result[rip]
ret
Thank you very much for your time and effort! We look forward to hearing from
you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114969] [11/12/13/14/15 Regression] Missed optimization: (bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | ( var_0 ? 1 : 0)) => (bool) var_0
2024-05-07 10:22 [Bug tree-optimization/114969] New: [11/12/13/14/15 Regression] Missed optimization: (bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | ( var_0 ? 1 : 0)) => (bool) var_0 652023330028 at smail dot nju.edu.cn
@ 2024-05-07 11:26 ` rguenth at gcc dot gnu.org
2024-05-08 3:44 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 11:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114969
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.5
Keywords| |missed-optimization
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114969] [11/12/13/14/15 Regression] Missed optimization: (bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | ( var_0 ? 1 : 0)) => (bool) var_0
2024-05-07 10:22 [Bug tree-optimization/114969] New: [11/12/13/14/15 Regression] Missed optimization: (bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | ( var_0 ? 1 : 0)) => (bool) var_0 652023330028 at smail dot nju.edu.cn
2024-05-07 11:26 ` [Bug tree-optimization/114969] " rguenth at gcc dot gnu.org
@ 2024-05-08 3:44 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-08 3:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114969
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=111542
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
very similar to PR 111542 .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-08 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 10:22 [Bug tree-optimization/114969] New: [11/12/13/14/15 Regression] Missed optimization: (bool)((std::max((unsigned long long) 0, (unsigned long long) var_0)) | ( var_0 ? 1 : 0)) => (bool) var_0 652023330028 at smail dot nju.edu.cn
2024-05-07 11:26 ` [Bug tree-optimization/114969] " rguenth at gcc dot gnu.org
2024-05-08 3:44 ` 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).