* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
@ 2020-03-10 17:00 ` pinskia at gcc dot gnu.org
2020-03-10 17:25 ` jakub at gcc dot gnu.org
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-10 17:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|wrong code at -O3 on |[9/10 Regression] wrong
|x86_64-linux-gnu |code at -O3 on
| |x86_64-linux-gnu
Keywords| |wrong-code
Version|unknown |10.0
Target Milestone|--- |9.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
2020-03-10 17:00 ` [Bug tree-optimization/94125] [9/10 Regression] " pinskia at gcc dot gnu.org
@ 2020-03-10 17:25 ` jakub at gcc dot gnu.org
2020-03-10 17:34 ` jakub at gcc dot gnu.org
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-10 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Somewhat reduced testcase:
unsigned char b, f;
short d[1][8][1], *g = &d[0][3][0];
int
main ()
{
int k[] = { 0, 0, 0, 4, 0, 0 };
for (int c = 2; c >= 0; c--)
{
b = f;
*g = k[c + 3];
k[c + 1] = 0;
}
for (int i = 0; i < 8; i++)
if (d[0][i][0] != 0)
__builtin_abort ();
return 0;
}
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
2020-03-10 17:00 ` [Bug tree-optimization/94125] [9/10 Regression] " pinskia at gcc dot gnu.org
2020-03-10 17:25 ` jakub at gcc dot gnu.org
@ 2020-03-10 17:34 ` jakub at gcc dot gnu.org
2020-03-10 17:34 ` jakub at gcc dot gnu.org
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-10 17:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems it is the ldist pass, which fails to figure out that k[c+3] load in the
loop might alias with the k[c+1] = 0; store and moves all the 3 stores into a
memset after the loop.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (2 preceding siblings ...)
2020-03-10 17:34 ` jakub at gcc dot gnu.org
@ 2020-03-10 17:34 ` jakub at gcc dot gnu.org
2020-03-10 18:09 ` law at redhat dot com
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-10 17:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-03-10
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (3 preceding siblings ...)
2020-03-10 17:34 ` jakub at gcc dot gnu.org
@ 2020-03-10 18:09 ` law at redhat dot com
2020-03-11 7:39 ` rguenth at gcc dot gnu.org
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: law at redhat dot com @ 2020-03-10 18:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at redhat dot com
Priority|P3 |P1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (4 preceding siblings ...)
2020-03-10 18:09 ` law at redhat dot com
@ 2020-03-11 7:39 ` rguenth at gcc dot gnu.org
2020-03-11 9:46 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-11 7:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Status|NEW |ASSIGNED
Priority|P1 |P2
Known to work| |8.3.0
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'll have a look. Note the bisection point is a correctness fix only possibly
resulting in less optimization.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (5 preceding siblings ...)
2020-03-11 7:39 ` rguenth at gcc dot gnu.org
@ 2020-03-11 9:46 ` rguenth at gcc dot gnu.org
2020-03-11 9:58 ` amker at gcc dot gnu.org
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-11 9:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amker at gcc dot gnu.org
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hm, it computes a dependence distance of two and in the end sorts partitions
in the wrong order from a bogus partition dependence edge. The odd thing is
that for
for (int c = 0; c <= 2; c++)
{
b = f;
*g = k[c + 3];
k[c + 1] = 0;
}
we compute a distance of minus two (two + DDR_REVERSED_P) but in both
cases we need to use the same partition ordering, memset after the
partition containing the k[c+3] load but the partition dependence code
from the DDRs appearant different direction handles both cases differently.
Something is missing here. Not sure what - Bin, any idea?
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (6 preceding siblings ...)
2020-03-11 9:46 ` rguenth at gcc dot gnu.org
@ 2020-03-11 9:58 ` amker at gcc dot gnu.org
2020-03-12 11:59 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: amker at gcc dot gnu.org @ 2020-03-11 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #5 from bin cheng <amker at gcc dot gnu.org> ---
Thanks for CCing, I will have a look this WE.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (7 preceding siblings ...)
2020-03-11 9:58 ` amker at gcc dot gnu.org
@ 2020-03-12 11:59 ` jakub at gcc dot gnu.org
2020-03-15 6:23 ` amker at gcc dot gnu.org
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-12 11:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.3 |9.4
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 9.3.0 has been released, adjusting target milestone.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (8 preceding siblings ...)
2020-03-12 11:59 ` jakub at gcc dot gnu.org
@ 2020-03-15 6:23 ` amker at gcc dot gnu.org
2020-03-16 3:15 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: amker at gcc dot gnu.org @ 2020-03-15 6:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #7 from bin cheng <amker at gcc dot gnu.org> ---
Patch at https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542038.html
It's a latent bug exposed by the mentioned alias analysis change, however:
unsigned char b, f;
short d[1][8][1], *g = &d[0][3][0];
int
main ()
{
int k[] = { 0, 0, 0, 4, 0, 0 };
for (int c = 2; c >= 0; c--)
{
b = f;
*g = k[c + 3];
k[c + 1] = 0;
}
for (int i = 0; i < 8; i++)
if (d[0][i][0] != 0)
__builtin_abort ();
return 0;
}
We can't tell no-alias info for pairs <f, *g> and <b, *g>. Is this expected or
should be improved?
Thanks
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (9 preceding siblings ...)
2020-03-15 6:23 ` amker at gcc dot gnu.org
@ 2020-03-16 3:15 ` cvs-commit at gcc dot gnu.org
2020-03-16 7:38 ` rguenther at suse dot de
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-16 3:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bin Cheng <amker@gcc.gnu.org>:
https://gcc.gnu.org/g:e4e9a59105a81cdd6c1328b0a5ed9fe4cc82840e
commit r10-7184-ge4e9a59105a81cdd6c1328b0a5ed9fe4cc82840e
Author: Bin Cheng <bin.cheng@linux.alibaba.com>
Date: Mon Mar 16 11:09:14 2020 +0800
Update post order number for merged SCC.
Function loop_distribution::break_alias_scc_partitions needs to compute
SCC with runtime alias edges skipped. As a result, partitions could be
re-assigned larger post order number than SCC's precedent partition and
distributed before the precedent one. This fixes the issue by updating
the merged partition to the minimal post order in SCC.
gcc/
PR tree-optimization/94125
* tree-loop-distribution.c
(loop_distribution::break_alias_scc_partitions): Update post order
number for merged scc.
gcc/testsuite/
PR tree-optimization/94125
* gcc.dg/tree-ssa/pr94125.c: New test.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9/10 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (10 preceding siblings ...)
2020-03-16 3:15 ` cvs-commit at gcc dot gnu.org
@ 2020-03-16 7:38 ` rguenther at suse dot de
2020-03-16 7:44 ` [Bug tree-optimization/94125] [9 " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenther at suse dot de @ 2020-03-16 7:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> ---
On Sun, 15 Mar 2020, amker at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
>
> --- Comment #7 from bin cheng <amker at gcc dot gnu.org> ---
> Patch at https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542038.html
> It's a latent bug exposed by the mentioned alias analysis change, however:
>
>
> unsigned char b, f;
> short d[1][8][1], *g = &d[0][3][0];
>
> int
> main ()
> {
> int k[] = { 0, 0, 0, 4, 0, 0 };
> for (int c = 2; c >= 0; c--)
> {
> b = f;
> *g = k[c + 3];
> k[c + 1] = 0;
> }
> for (int i = 0; i < 8; i++)
> if (d[0][i][0] != 0)
> __builtin_abort ();
> return 0;
> }
>
> We can't tell no-alias info for pairs <f, *g> and <b, *g>. Is this expected or
> should be improved?
This is expected when g is not static [const] (we should discover it
as const) or when not using LTO (which should as well promote the
variable to const short *). Adding a restrict qualifier to g should
also solve it.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (11 preceding siblings ...)
2020-03-16 7:38 ` rguenther at suse dot de
@ 2020-03-16 7:44 ` rguenth at gcc dot gnu.org
2020-03-18 9:52 ` amker at gcc dot gnu.org
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-16 7:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10 Regression] wrong |[9 Regression] wrong code
|code at -O3 on |at -O3 on x86_64-linux-gnu
|x86_64-linux-gnu |
Known to fail| |9.3.0
Known to work| |10.0
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thanks Bin, fixed on trunk sofar.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (12 preceding siblings ...)
2020-03-16 7:44 ` [Bug tree-optimization/94125] [9 " rguenth at gcc dot gnu.org
@ 2020-03-18 9:52 ` amker at gcc dot gnu.org
2020-03-18 10:41 ` rguenther at suse dot de
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: amker at gcc dot gnu.org @ 2020-03-18 9:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #11 from bin cheng <amker at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #10)
> Thanks Bin, fixed on trunk sofar.
Hmm, if it's fine, I will backport this to GCC9.
Thanks
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (13 preceding siblings ...)
2020-03-18 9:52 ` amker at gcc dot gnu.org
@ 2020-03-18 10:41 ` rguenther at suse dot de
2020-03-24 9:45 ` cvs-commit at gcc dot gnu.org
2020-03-24 10:00 ` rguenth at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: rguenther at suse dot de @ 2020-03-18 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 18 Mar 2020, amker at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
>
> --- Comment #11 from bin cheng <amker at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #10)
> > Thanks Bin, fixed on trunk sofar.
>
> Hmm, if it's fine, I will backport this to GCC9.
I think so.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (14 preceding siblings ...)
2020-03-18 10:41 ` rguenther at suse dot de
@ 2020-03-24 9:45 ` cvs-commit at gcc dot gnu.org
2020-03-24 10:00 ` rguenth at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-24 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Bin Cheng <amker@gcc.gnu.org>:
https://gcc.gnu.org/g:95c969e58f7905b14d3f2889cf41595eb2c13cbb
commit r9-8411-g95c969e58f7905b14d3f2889cf41595eb2c13cbb
Author: Bin Cheng <bin.cheng@linux.alibaba.com>
Date: Tue Mar 24 17:40:21 2020 +0800
backport PR94125: Update post order number for merged SCC.
Function loop_distribution::break_alias_scc_partitions needs to compute
SCC with runtime alias edges skipped. As a result, partitions could be
re-assigned larger post order number than SCC's precedent partition and
distributed before the precedent one. This fixes the issue by updating
the merged partition to the minimal post order in SCC.
Backport from mainline.
PR tree-optimization/94125
* tree-loop-distribution.c
(loop_distribution::break_alias_scc_partitions): Update post order
number for merged scc.
* gcc.dg/tree-ssa/pr94125.c: New test.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug tree-optimization/94125] [9 Regression] wrong code at -O3 on x86_64-linux-gnu
2020-03-10 16:54 [Bug tree-optimization/94125] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
` (15 preceding siblings ...)
2020-03-24 9:45 ` cvs-commit at gcc dot gnu.org
@ 2020-03-24 10:00 ` rguenth at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-24 10:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94125
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Known to work| |9.3.1
Status|ASSIGNED |RESOLVED
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 18+ messages in thread