* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
@ 2023-06-26 10:11 ` jwzeng at nuaa dot edu.cn
2023-06-26 11:37 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jwzeng at nuaa dot edu.cn @ 2023-06-26 10:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
--- Comment #1 from Jw Zeng <jwzeng at nuaa dot edu.cn> ---
Link to the Compiler Explorer: https://godbolt.org/z/d5v5scnP4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
2023-06-26 10:11 ` [Bug tree-optimization/110410] " jwzeng at nuaa dot edu.cn
@ 2023-06-26 11:37 ` rguenth at gcc dot gnu.org
2023-06-26 12:32 ` jwzeng at nuaa dot edu.cn
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-26 11:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection, wrong-code
Target Milestone|--- |14.0
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
phi-opt again?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
2023-06-26 10:11 ` [Bug tree-optimization/110410] " jwzeng at nuaa dot edu.cn
2023-06-26 11:37 ` rguenth at gcc dot gnu.org
@ 2023-06-26 12:32 ` jwzeng at nuaa dot edu.cn
2023-06-26 15:58 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jwzeng at nuaa dot edu.cn @ 2023-06-26 12:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
--- Comment #3 from Jw Zeng <jwzeng at nuaa dot edu.cn> ---
(In reply to Richard Biener from comment #2)
> phi-opt again?
Link to the Compiler Explorer:https://godbolt.org/z/EeEqMGnWo
I reduced the code again, I hope it helps. The reduced code is as follows:
#include <stdio.h>
int var_1 = 1;
int var_2 = 0;
unsigned short var_3 = 7472;
int var_4 = 518868156U;
unsigned var_5;
#define min(a, b) ((a) < (b) ? (a) : (b))
int main() {
var_5 = min(var_1 ? var_3 >> (var_4 - 518868145U) : var_2, 1);
printf("%d\n", var_5);
return 0;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
` (2 preceding siblings ...)
2023-06-26 12:32 ` jwzeng at nuaa dot edu.cn
@ 2023-06-26 15:58 ` pinskia at gcc dot gnu.org
2023-06-26 16:07 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-26 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes phiopt again:
_7 = _3 >> _6;
iftmp.7_27 = (unsigned int) _7;
_13 = _7 > 0;
_12 = (unsigned int) _13;
_11 = _12 | iftmp.7_27;
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
` (3 preceding siblings ...)
2023-06-26 15:58 ` pinskia at gcc dot gnu.org
@ 2023-06-26 16:07 ` pinskia at gcc dot gnu.org
2023-06-26 21:32 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-26 16:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |110252
Status|UNCONFIRMED |NEW
Keywords|needs-bisection |missed-optimization
Ever confirmed|0 |1
Last reconfirmed| |2023-06-26
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is basically a dup of bug 110252 as the range of iftmp.7_27 is flow
sensitive here.
BUT there is a missed optimization before hand though:
# RANGE [irange] unsigned int [0, 0] NONZERO 0x0
iftmp.7_27 = (unsigned intD.9) _7;
This shows up in dom3. So keeping it open for that case too ...
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110252
[Bug 110252] [14 Regression] Wrong code at -O2/3/s on x86_64-linux-gnu
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
` (4 preceding siblings ...)
2023-06-26 16:07 ` pinskia at gcc dot gnu.org
@ 2023-06-26 21:32 ` pinskia at gcc dot gnu.org
2023-07-19 16:19 ` pinskia at gcc dot gnu.org
2023-07-19 16:36 ` [Bug tree-optimization/110410] Missed optimization in DOM with a single value range pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-26 21:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jw Zeng from comment #3)
> (In reply to Richard Biener from comment #2)
> > phi-opt again?
>
> Link to the Compiler Explorer:https://godbolt.org/z/EeEqMGnWo
>
> I reduced the code again, I hope it helps. The reduced code is as follows:
This reduced testcase is the same issue except it is dom2 which has the missed
optimization:
Exported global range table:
============================
_3 : [irange] int [0, 65535] NONZERO 0xffff
_7 : [irange] int [0, 65535] NONZERO 0xffff
iftmp.0_16 : [irange] unsigned int [0, 1][2147483648, +INF]
iftmp.7_21 : [irange] unsigned int [0, 0][2147483648, +INF]
iftmp.7_22 : [irange] unsigned int [0, 0] NONZERO 0x0
Note the reason why dom3 is able to figure out:
# VUSE <.MEM_18(D)>
var_3.9_9 = var_3;
is the same as var_3.3_2
and not fre3 is because a jump threading is needed to happen before. Once dom3
is already to figure that out, it becomes obvious that is _22 is 0 and such.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] [14 Regression] Different results between -O0 and -O2
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
` (5 preceding siblings ...)
2023-06-26 21:32 ` pinskia at gcc dot gnu.org
@ 2023-07-19 16:19 ` pinskia at gcc dot gnu.org
2023-07-19 16:36 ` [Bug tree-optimization/110410] Missed optimization in DOM with a single value range pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19 16:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
Bug 110410 depends on bug 110252, which changed state.
Bug 110252 Summary: [14 Regression] Wrong code at -O2/3/s on x86_64-linux-gnu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110252
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/110410] Missed optimization in DOM with a single value range
2023-06-26 9:38 [Bug tree-optimization/110410] New: [14 Regression] Different results between -O0 and -O2 jwzeng at nuaa dot edu.cn
` (6 preceding siblings ...)
2023-07-19 16:19 ` pinskia at gcc dot gnu.org
@ 2023-07-19 16:36 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19 16:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110410
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |---
Keywords|wrong-code |
Summary|[14 Regression] Different |Missed optimization in DOM
|results between -O0 and -O2 |with a single value range
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The reduced testcase in comment #3 still has the missed optimization so keeping
this open and changing the summary and removing the regression marker.
^ permalink raw reply [flat|nested] 9+ messages in thread