public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional
@ 2021-03-23 20:56 msebor at gcc dot gnu.org
2021-03-24 9:13 ` [Bug tree-optimization/99739] " rguenth at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-23 20:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Bug ID: 99739
Summary: [11 Regression] missing optimization of a repeated
conditional
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
Prior to r11-5805 both ff() and gg() in the test case below resulted in optimal
code. With the change, the second conditional in g() is no longer recognized
as equivalent to the first and so the function isn't optimized as expected.
Incidentally, the same regression was also introduced once before: in r235653.
$ cat x.c && gcc -O1 -S -Wall -fdump-tree-optimized=/dev/stdout x.c
static inline int f (int i, int j, int k)
{
int x = 1;
if (i && j && k)
x = 2;
if (i && j && k)
return x;
return -1;
}
void ff (int i, int j, int k)
{
int x = f (i, j, k);
if (x == 1)
__builtin_abort ();
}
static inline int g (int i, int j, int k)
{
int x = 1;
if (i && j && k)
x = 2;
if (i && k && j)
return x;
return -1;
}
void gg (int i, int j, int k)
{
int x = g (i, j, k);
if (x == 1)
__builtin_abort ();
}
;; Function ff (ff, funcdef_no=1, decl_uid=1951, cgraph_uid=2, symbol_order=1)
void ff (int i, int j, int k)
{
<bb 2> [local count: 1073741824]:
return;
}
;; Function gg (gg, funcdef_no=3, decl_uid=1963, cgraph_uid=4, symbol_order=3)
Removing basic block 6
Removing basic block 7
void gg (int i, int j, int k)
{
_Bool _7;
_Bool _8;
_Bool _11;
_Bool _14;
_Bool _16;
<bb 2> [local count: 1073741824]:
_7 = i_2(D) != 0;
_8 = j_3(D) != 0;
_14 = k_4(D) != 0;
_11 = _7 & _14;
_16 = _8 & _11;
if (_16 != 0)
goto <bb 3>; [94.27%]
else
goto <bb 5>; [5.73%]
<bb 3> [local count: 1012175616]:
if (k_4(D) != 0)
goto <bb 5>; [100.00%]
else
goto <bb 4>; [0.00%]
<bb 4> [count: 0]:
__builtin_abort ();
<bb 5> [local count: 1073741824]:
return;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
@ 2021-03-24 9:13 ` rguenth at gcc dot gnu.org
2021-04-27 11:40 ` [Bug tree-optimization/99739] [11/12 " jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-24 9:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Whether we handle this or not at -O1 is quite dependent on short-circuiting
anyway - we only have jump threading at our hands at -O1 (we could consider
enabling non-iterating EVRP).
So I'm not sure this is an important regression. At -O2 we end up with
<bb 2> [local count: 1073741824]:
_7 = i_2(D) != 0;
_8 = j_3(D) != 0;
_9 = _7 & _8;
if (_9 != 0)
goto <bb 5>; [50.00%]
else
goto <bb 3>; [50.00%]
<bb 3> [local count: 536870911]:
_23 = k_4(D) != 0;
_24 = _7 & _23;
_11 = _8 & _24;
if (_11 != 0)
goto <bb 4>; [94.27%]
else
goto <bb 5>; [5.73%]
<bb 4> [count: 0]:
__builtin_abort ();
<bb 5> [local count: 1073741824]:
return;
where reassociation leaves redundant _9 on the plate.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
2021-03-24 9:13 ` [Bug tree-optimization/99739] " rguenth at gcc dot gnu.org
@ 2021-04-27 11:40 ` jakub at gcc dot gnu.org
2021-07-28 7:06 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.0 |11.2
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
2021-03-24 9:13 ` [Bug tree-optimization/99739] " rguenth at gcc dot gnu.org
2021-04-27 11:40 ` [Bug tree-optimization/99739] [11/12 " jakub at gcc dot gnu.org
@ 2021-07-28 7:06 ` rguenth at gcc dot gnu.org
2022-04-21 7:49 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |11.3
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
` (2 preceding siblings ...)
2021-07-28 7:06 ` rguenth at gcc dot gnu.org
@ 2022-04-21 7:49 ` rguenth at gcc dot gnu.org
2023-03-23 17:57 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21 7:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.3 |11.4
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
` (3 preceding siblings ...)
2022-04-21 7:49 ` rguenth at gcc dot gnu.org
@ 2023-03-23 17:57 ` pinskia at gcc dot gnu.org
2023-03-23 18:03 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-23 17:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |13.0
Keywords| |needs-bisection
Summary|[11/12/13 Regression] |[11/12 Regression] missing
|missing optimization of a |optimization of a repeated
|repeated conditional |conditional
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This seems to have been fixed on the trunk ... It would be a nice idea to see
what fixed it.
Note dom3 is able to figure out they are the same.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
` (4 preceding siblings ...)
2023-03-23 17:57 ` pinskia at gcc dot gnu.org
@ 2023-03-23 18:03 ` jakub at gcc dot gnu.org
2023-03-24 8:41 ` cvs-commit at gcc dot gnu.org
2023-05-29 10:04 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-23 18:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |jakub at gcc dot gnu.org
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
r13-1268-g8c99e307b20c502e55c4258
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
` (5 preceding siblings ...)
2023-03-23 18:03 ` jakub at gcc dot gnu.org
@ 2023-03-24 8:41 ` cvs-commit at gcc dot gnu.org
2023-05-29 10:04 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-24 8:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:86111e7b3027de1029718e23ee5fab0ee011e191
commit r13-6845-g86111e7b3027de1029718e23ee5fab0ee011e191
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Mar 24 09:39:59 2023 +0100
testsuite: Add testcase for already fixed PR [PR99739]
This PR was fixed by r13-1268-g8c99e307b20, I'm adding testcase
to make sure we don't regress on it in the future.
2023-03-24 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/99739
* gcc.dg/tree-ssa/pr99739.c: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/99739] [11/12 Regression] missing optimization of a repeated conditional
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
` (6 preceding siblings ...)
2023-03-24 8:41 ` cvs-commit at gcc dot gnu.org
@ 2023-05-29 10:04 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99739
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.4 |11.5
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-05-29 10:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 20:56 [Bug tree-optimization/99739] New: [11 Regression] missing optimization of a repeated conditional msebor at gcc dot gnu.org
2021-03-24 9:13 ` [Bug tree-optimization/99739] " rguenth at gcc dot gnu.org
2021-04-27 11:40 ` [Bug tree-optimization/99739] [11/12 " jakub at gcc dot gnu.org
2021-07-28 7:06 ` rguenth at gcc dot gnu.org
2022-04-21 7:49 ` rguenth at gcc dot gnu.org
2023-03-23 17:57 ` pinskia at gcc dot gnu.org
2023-03-23 18:03 ` jakub at gcc dot gnu.org
2023-03-24 8:41 ` cvs-commit at gcc dot gnu.org
2023-05-29 10:04 ` jakub 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).