[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-15 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #19 from Jan Hubicka  ---
I looked into the remaining exit/nonexit rename discussed here earlier before
the PR was closed. The following patch would restore the code to do the same
calls as before my patch
PR tree-optimization/109596
* tree-ssa-loop-ch.c (ch_base::copy_headers): Fix use of exit/nonexit
edges.
diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc
index b7ef485c4cc..cd5f6bc3c2a 100644
--- a/gcc/tree-ssa-loop-ch.cc
+++ b/gcc/tree-ssa-loop-ch.cc
@@ -952,13 +952,13 @@ ch_base::copy_headers (function *fun)
   if (!single_pred_p (nonexit->dest))
{
  header = split_edge (nonexit);
- exit = single_pred_edge (header);
+ nonexit = single_pred_edge (header);
}

   edge entry = loop_preheader_edge (loop);

   propagate_threaded_block_debug_into (nonexit->dest, entry->dest);
-  if (!gimple_duplicate_seme_region (entry, exit, bbs, n_bbs, copied_bbs,
+  if (!gimple_duplicate_seme_region (entry, nonexit, bbs, n_bbs,
copied_bbs,
 true))
{
  delete candidate.static_exits;

I however convinced myself this is an noop. both exit and nonexit sources have
same basic blocks.  

propagate_threaded_block_debug_into walks predecessors of its first parameter
and moves debug statements to the second parameter, so it does the same job,
since the split BB is empty.

gimple_duplicate_seme_region uses the parametr to update loop header but it
does not do that correctly for loop header copying and we re-do it in
tree-ssa-loop-ch.

Still the code as it is now in trunk is very confusing, so perhaps we should
update it?

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-13 Thread haochen.jiang at intel dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #18 from Haochen Jiang  ---
(In reply to Andrew Pinski from comment #16)
> (In reply to Carlos Eduardo Seo from comment #15)
> > I see some failures after this patch on aarch64-linux-gnu:
> > 
> > FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
> > -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
> > FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
> > -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
> > FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
> > -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
> > 
> > Could you please take a look?
> 
> I suspect it is similar to what was already discussed here: 
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649347.html

Yes. As Richard said, the FAIL are exactly the same before Honza's patch, I
suppose expected.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-12 Thread carlos.seo at linaro dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #17 from Carlos Eduardo Seo  ---
Noted. Thanks!

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #16 from Andrew Pinski  ---
(In reply to Carlos Eduardo Seo from comment #15)
> I see some failures after this patch on aarch64-linux-gnu:
> 
> FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
> -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
> FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
> -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
> FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
> -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
> 
> Could you please take a look?

I suspect it is similar to what was already discussed here: 

https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649347.html

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-12 Thread carlos.seo at linaro dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

Carlos Eduardo Seo  changed:

   What|Removed |Added

 CC||carlos.seo at linaro dot org

--- Comment #15 from Carlos Eduardo Seo  ---
I see some failures after this patch on aarch64-linux-gnu:

FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i

Could you please take a look?

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-11 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

Richard Biener  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #14 from Richard Biener  ---
The guality FAILs have been fixed now.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #13 from GCC Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:c7e8a8d814229fd6fc4c16c2452f15dddc613479

commit r14-9912-gc7e8a8d814229fd6fc4c16c2452f15dddc613479
Author: Richard Biener 
Date:   Thu Apr 11 11:08:07 2024 +0200

tree-optimization/109596 - wrong debug stmt move by copyheader

The following fixes an omission in r14-162-gcda246f8b421ba causing
wrong-debug and a bunch of guality regressions.

PR tree-optimization/109596
* tree-ssa-loop-ch.cc (ch_base::copy_headers): Propagate
debug stmts to nonexit->dest rather than exit->dest.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-11 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #12 from Richard Biener  ---
I'm re-testing the patch in comment#8 and will push it.  Please check the
possible issue mentioned in comment#9.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-04-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #11 from Richard Biener  ---
Honza - any progress here?

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-20 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #10 from Jakub Jelinek  ---
(In reply to Jakub Jelinek from comment #9)
> BTW, just curious, r14-162 had:
>/* Ensure that the header will have just the latch as a predecessor
>  inside the loop.  */
> -  if (!single_pred_p (exit->dest))
> +  if (!single_pred_p (nonexit->dest))
> {
> - header = split_edge (exit);
> + header = split_edge (nonexit);
>   exit = single_pred_edge (header);
> }
> chunk, shouldn't that be nonexit = single_pred_edge (header); or is that
> line correct?

Regarding that, e.g. gcc.c-torture/compile/pr70199.c testcase at -O1 -g shows
both cases, once where single_pred_p (nonexit->dest) and once where
!single_pred_p (nonexit->dest) and we split the nonexit edge.
Or the !single_pred_p case is also in c-c++-common/gomp/pr59917-2.c,
gcc.dg/torture/pr83685.c.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #9 from Jakub Jelinek  ---
BTW, just curious, r14-162 had:
   /* Ensure that the header will have just the latch as a predecessor
 inside the loop.  */
-  if (!single_pred_p (exit->dest))
+  if (!single_pred_p (nonexit->dest))
{
- header = split_edge (exit);
+ header = split_edge (nonexit);
  exit = single_pred_edge (header);
}
chunk, shouldn't that be nonexit = single_pred_edge (header); or is that line
correct?

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #8 from Jakub Jelinek  ---
Great,
--- gcc/tree-ssa-loop-ch.cc.jj  2024-03-19 16:27:35.969474787 +0100
+++ gcc/tree-ssa-loop-ch.cc 2024-03-19 17:12:57.904712489 +0100
@@ -957,7 +957,7 @@ ch_base::copy_headers (function *fun)

   edge entry = loop_preheader_edge (loop);

-  propagate_threaded_block_debug_into (exit->dest, entry->dest);
+  propagate_threaded_block_debug_into (nonexit->dest, entry->dest);
   if (!gimple_duplicate_seme_region (entry, exit, bbs, n_bbs, copied_bbs,
 true))
{
looks very much promising:
-XFAIL: gcc.dg/guality/example.c   -O1  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/example.c   -O1  -DPREVENT_OPTIMIZATION  execution test
-FAIL: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
+PASS: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
-FAIL: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
+PASS: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
-PASS: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
+FAIL: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
-PASS: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
+FAIL: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
-FAIL: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21
x == 10 - i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21
y == 20 - 2 * i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21
z == 30 - 3 * i
+PASS: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
+PASS: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 x ==
10 - i
+PASS: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 y ==
20 - 2 * i
+PASS: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 z ==
30 - 3 * i
-FAIL: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21
x == 10 - i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21
y == 20 - 2 * i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21
z == 30 - 3 * i
+PASS: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
+PASS: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 x ==
10 - i
+PASS: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 y ==
20 - 2 * i
+PASS: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 z ==
30 - 3 * i
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 i == v + 1
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
+PASS: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 i == v + 1
+PASS: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
+PASS: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
+PASS: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
-UNSUPPORTED: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
+FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
+FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

Jan Hubicka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org

--- Comment #7 from Jan Hubicka  ---
Found it, probably. I renamed exit to nonexit (since name was misleading) and
then forgot to update
 propagate_threaded_block_debug_into (exit->dest, entry->dest);

I will check this after teaching (which I have in 10 mins)

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #6 from Jan Hubicka  ---
On this testcase trunk does get same dump as gcc13 for pass just before ch2

with ch2 we get:
@@ -192,9 +236,8 @@
   # DEBUG BEGIN_STMT
   goto ; [100.00%]

-   [local count: 954449105]:
+   [local count: 954449104]:
   # j_15 = PHI 
-  # DEBUG j => j_15
   # DEBUG BEGIN_STMT
   a[b_14][j_15] = 0;
   # DEBUG BEGIN_STMT
@@ -203,29 +246,30 @@
   # DEBUG j => j_9
   # DEBUG BEGIN_STMT
   if (j_9 <= 7)
-goto ; [88.89%]
+goto ; [87.50%]
   else
-goto ; [11.11%]
+goto ; [12.50%]

[local count: 119292720]:
+  # DEBUG j => 0
   # DEBUG BEGIN_STMT
   b_7 = b_14 + 1;
   # DEBUG b => b_7
   # DEBUG b => b_7
   # DEBUG BEGIN_STMT
   if (b_7 <= 6)
-goto ; [87.50%]
+goto ; [85.71%]
   else
-goto ; [12.50%]
+goto ; [14.29%]

[local count: 119292720]:
   # b_14 = PHI 
-  # DEBUG b => b_14
   # DEBUG j => 0
   # DEBUG BEGIN_STMT
   goto ; [100.00%]

[local count: 17041817]:
+  # DEBUG b => 0
   # DEBUG BEGIN_STMT
   optimize_me_not ();
   # DEBUG BEGIN_STMT


So in addition to updating BB profile, we indeed end up moving debug statements
around.

The change of dump is:
+  Analyzing: if (b_1 <= 6)
+Will eliminate peeled conditional in bb 6.
+May duplicate bb 6
+  Not duplicating bb 8: it is single succ.
+  Analyzing: if (j_2 <= 7)
+Will eliminate peeled conditional in bb 4.
+May duplicate bb 4
+  Not duplicating bb 3: it is single succ.
 Loop 2 is not do-while loop: latch is not empty.
+Duplicating header BB to obtain do-while loop
 Copying headers of loop 1
 Will duplicate bb 6
-  Not duplicating bb 8: it is single succ.
-Duplicating header of the loop 1 up to edge 6->8, 2 insns.
+Duplicating header of the loop 1 up to edge 6->7
 Loop 1 is do-while loop
 Loop 1 is now do-while loop.
+Exit count: 17041817 (estimated locally)
+Entry count: 17041817 (estimated locally)
+Peeled all exits: decreased number of iterations of loop 1 by 1.
 Copying headers of loop 2
 Will duplicate bb 4
-  Not duplicating bb 3: it is single succ.
-Duplicating header of the loop 2 up to edge 4->3, 2 insns.
+Duplicating header of the loop 2 up to edge 4->5
 Loop 2 is do-while loop
 Loop 2 is now do-while loop.
+Exit count: 119292720 (estimated locally)
+Entry count: 119292720 (estimated locally)
+Peeled all exits: decreased number of iterations of loop 2 by 1.

Dumps moved around, but we do same duplicaitons as before (BB6 and BB4 to
eliminate the conditionals).

   [local count: 1073741824]:
  # j_2 = PHI <0(8), j_9(3)>
  # DEBUG j => j_2
  # DEBUG BEGIN_STMT
  if (j_2 <= 7)
goto ; [88.89%]
  else
goto ; [11.11%]

   [local count: 136334537]:
  # b_1 = PHI <0(2), b_7(5)>
  # DEBUG b => b_1
  # DEBUG BEGIN_STMT
  if (b_1 <= 6)
goto ; [87.50%]
  else
goto ; [12.50%]

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #5 from Jakub Jelinek  ---
(In reply to Jan Hubicka from comment #4)
> The change makes loop iteration estimates more realistics, but does not
> introduce any new code that actually changes the IL, so it seems this makes
> existing problem more visible.  I will try to debug what happens.

Yeah, I didn't see any debug info handling in that commit, so wouldn't surprise
me if it was something latent before, or something where ch now needs to do a
better job.
All I can see from the dumps is that before ch2 the debug stmt placements were
reasonable both for b and j, b 0 at the very start and after SSA_NAME def stmts
which update it to a new value for the var (e.g. after PHI at the start of loop
body,
or after increasing the IV).
Before r14-162 ch2 used to do weird stuff with them - duplicating
  # DEBUG b => 0
  # DEBUG b => 0
at the start, after ++j:
  # DEBUG j => j_9
  # DEBUG j => j_9
after ++b:
  # DEBUG b => b_7
  # DEBUG b => b_7
and (the perhaps only reasonable change adding
  # DEBUG j => 0
after the b PHI, though not really necessary as it has unconditional goto to
the header with PHI after which it is set to something else).
But, newly ch2 in addition to the useless duplicate of b => 0, j => j_9 and b
=> b_7
removes the most important debug stmts (
  # DEBUG j => j_2
and
  # DEBUG b => b_1
after the PHIs) and adds wrong-debug debug stmts elsewhere - the
  # DEBUG j => 0
and
  # DEBUG b => 0
in random incorrect places.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #4 from Jan Hubicka  ---
The change makes loop iteration estimates more realistics, but does not
introduce any new code that actually changes the IL, so it seems this makes
existing problem more visible.  I will try to debug what happens.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #3 from Jakub Jelinek  ---
Loooking at pr90716.c, that case seems like a clear wrong-debug.
Before r14-162 j was  everywhere, "j\0" DW_TAG_variable didn't
have any DW_AT_location/DW_AT_const_value, optimized dump doesn't show any
DEBUG stmts for j nor any references to it, etc.
With r14-162 and later the DW_TAG_variable has DW_AT_const_value 0, which is
wrong,
if anything it should have DW_AT_const_value 8.
Optimized dump difference is
--- pr90716.c.254t.optimized_   2024-03-19 10:23:03.688427714 -0400
+++ pr90716.c.254t.optimized2024-03-19 10:23:39.351797960 -0400
@@ -18,19 +18,20 @@ void optimize_me_not ()
 int main ()
 {
[local count: 17041817]:
   # DEBUG BEGIN_STMT
   # DEBUG BEGIN_STMT
   # DEBUG b => 0
   # DEBUG BEGIN_STMT
   # DEBUG b => 0
   # DEBUG BEGIN_STMT
   __builtin_memset (, 0, 224);
-  # DEBUG b => NULL
+  # DEBUG j => 0
+  # DEBUG b => 0
   # DEBUG BEGIN_STMT
   optimize_me_not ();
   # DEBUG BEGIN_STMT
   return 0;

 }
Clearly even the b value is wrong, that again should be either 8 or NULL after
the loops.
Before ch2 pass, the IL is the same with r14-161 and r14-162:
   [local count: 17041817]:
  # DEBUG b => 0
  goto ; [100.00%]

   [local count: 954449105]:
  a[b_1][j_2] = 0;
  j_9 = j_2 + 1;
  # DEBUG j => j_9

   [local count: 1073741824]:
  # j_2 = PHI <0(8), j_9(3)>
  # DEBUG j => j_2
  if (j_2 != 8)
goto ; [88.89%]
  else
goto ; [11.11%]

   [local count: 119292720]:
  b_7 = b_1 + 1;
  # DEBUG b => b_7

   [local count: 136334537]:
  # b_1 = PHI <0(2), b_7(5)>
  # DEBUG b => b_1
  if (b_1 != 7)
goto ; [87.50%]
  else
goto ; [12.50%]

   [local count: 119292720]:
  goto ; [100.00%]

   [local count: 17041817]:
  optimize_me_not ();
  return 0;
but ch2 changes the IL (r14-161 vs. r14-162): 
--- pr90716.c.126t.ch2_ 2024-03-19 11:20:14.311013575 -0400
+++ pr90716.c.126t.ch2  2024-03-19 11:20:18.879061929 -0400
@@ -72,44 +72,44 @@ Removing basic block 12
 int main ()
 {
   int j;
   int b;

[local count: 17041817]:
   # DEBUG b => 0
   # DEBUG b => 0
   goto ; [100.00%]

[local count: 954449105]:
   # j_15 = PHI 
-  # DEBUG j => j_15
   a[b_14][j_15] = 0;
   j_9 = j_15 + 1;
   # DEBUG j => j_9
   # DEBUG j => j_9
   if (j_9 != 8)
 goto ; [88.89%]
   else
 goto ; [11.11%]

[local count: 119292720]:
+  # DEBUG j => 0
   b_7 = b_14 + 1;
   # DEBUG b => b_7
   # DEBUG b => b_7
   if (b_7 != 7)
 goto ; [87.50%]
   else
 goto ; [12.50%]

[local count: 119292720]:
   # b_14 = PHI 
-  # DEBUG b => b_14
   # DEBUG j => 0
   goto ; [100.00%]

[local count: 17041817]:
+  # DEBUG b => 0
   optimize_me_not ();
   return 0;

 }
The changes in r14-162 feel highly undesirable for debug info.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-03-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
ipa-sra-1.c has been adjusted since in r14-8997
Comparing current trunk vs. current 13 branch, I see in guality:
-XPASS: gcc.dg/guality/example.c   -O1  -DPREVENT_OPTIMIZATION  execution test
-XPASS: gcc.dg/guality/ipa-sra-1.c   -O0  line 15 k == 3
-XPASS: gcc.dg/guality/ipa-sra-1.c   -O1  -DPREVENT_OPTIMIZATION  line 15 k ==
3
-XPASS: gcc.dg/guality/ipa-sra-1.c  -Og -DPREVENT_OPTIMIZATION  line 15 k == 3
-FAIL: gcc.dg/guality/pr41616-1.c   -O2  -DPREVENT_OPTIMIZATION  execution test
-FAIL: gcc.dg/guality/pr41616-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION execution test
-FAIL: gcc.dg/guality/pr41616-1.c   -O3 -g  -DPREVENT_OPTIMIZATION  execution
test
-FAIL: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
-FAIL: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
+FAIL: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
+FAIL: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
+FAIL: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
+FAIL: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
+FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 i == v + 1
+FAIL: gcc.dg/guality/pr54693-2.c   -O3 -g  -DPREVENT_OPTIMIZATION  line 21 i
== v + 1
+FAIL: gcc.dg/guality/pr54693.c   -O1  -DPREVENT_OPTIMIZATION  line 22 i == c -
48
+FAIL: gcc.dg/guality/pr54693.c   -O2  -DPREVENT_OPTIMIZATION  line 22 i == c -
48
+FAIL: gcc.dg/guality/pr54693.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 22 i == c - 48
+FAIL: gcc.dg/guality/pr54693.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 22 i == c - 48
+FAIL: gcc.dg/guality/pr54693.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 22 i ==
c - 48
+FAIL: gcc.dg/guality/pr54693.c   -O3 -g  -DPREVENT_OPTIMIZATION  line 22 i ==
c - 48
+FAIL: gcc.dg/guality/pr54693.c   -Os  -DPREVENT_OPTIMIZATION  line 22 i == c -
48
+FAIL: gcc.dg/guality/pr89463.c   -O1  -DPREVENT_OPTIMIZATION  line 23 i + 1 ==
7
+FAIL: gcc.dg/guality/pr90074.c   -O1  -DPREVENT_OPTIMIZATION  line 28 c + 1 ==
2
+FAIL: gcc.dg/guality/pr90074.c   -O1  -DPREVENT_OPTIMIZATION  line 28 i + 1 ==
8
+FAIL: gcc.dg/guality/pr90716.c   -O1  -DPREVENT_OPTIMIZATION  line 23 j + 1 ==
9
+FAIL: gcc.dg/guality/pr90716.c   -O2  -DPREVENT_OPTIMIZATION  line 23 j + 1 ==
9
+FAIL: gcc.dg/guality/pr90716.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 23 j + 1 == 9
+FAIL: gcc.dg/guality/pr90716.c   -Os  -DPREVENT_OPTIMIZATION  line 23 j + 1 ==
9
+FAIL: gcc.dg/guality/vla-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 17 sizeof (a) == 6
where ipa-sra-1.c changes are because r14-8997 intentionally tweaked the
expectations for -O0/-O1/-Og.

[Bug testsuite/109596] [14 Regression] Lots of guality testcase fails on x86_64 after r14-162-gcda246f8b421ba

2024-01-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

Richard Biener  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-01-12
 Status|UNCONFIRMED |NEW
   Keywords||testsuite-fail
   Priority|P3  |P1

--- Comment #1 from Richard Biener  ---
13 branch vs trunk gcc.dg/guality on x86_64 with gdb 12.1 is

# of expected passes4768
# of unexpected failures93
# of unexpected successes   20
# of expected failures  79
# of unsupported tests  143

vs

# of expected passes4728
# of unexpected failures111
# of unexpected successes   19
# of expected failures  80
# of unsupported tests  165

-XPASS: gcc.dg/guality/example.c   -O1  -DPREVENT_OPTIMIZATION  execution test
+FAIL: gcc.dg/guality/ipa-sra-1.c   -O2  -DPREVENT_OPTIMIZATION  line 27 k == 3
+FAIL: gcc.dg/guality/ipa-sra-1.c   -O3 -g  -DPREVENT_OPTIMIZATION  line 27 k
== 3
+FAIL: gcc.dg/guality/ipa-sra-1.c   -Os  -DPREVENT_OPTIMIZATION  line 27 k == 3
 XPASS: gcc.dg/guality/ipa-sra-1.c  -Og -DPREVENT_OPTIMIZATION  line 15 k == 3
+FAIL: gcc.dg/guality/ipa-sra-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 27 k == 3
+FAIL: gcc.dg/guality/ipa-sra-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 27 k == 3
-FAIL: gcc.dg/guality/pr41616-1.c   -O2  -DPREVENT_OPTIMIZATION  execution test
-FAIL: gcc.dg/guality/pr41616-1.c   -O3 -g  -DPREVENT_OPTIMIZATION  execution
test
-FAIL: gcc.dg/guality/pr41616-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION execution test
-FAIL: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
-FAIL: gcc.dg/guality/pr43051-1.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
+FAIL: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 34 c ==
[0]
+FAIL: gcc.dg/guality/pr43051-1.c   -O1  -DPREVENT_OPTIMIZATION  line 39 c ==
[0]
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 x == 10 - i
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
-FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
+FAIL: gcc.dg/guality/pr54693-2.c   -O1  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
+FAIL: gcc.dg/guality/pr54693-2.c   -O2  -DPREVENT_OPTIMIZATION  line 21 i == v
+ 1
+FAIL: gcc.dg/guality/pr54693-2.c   -O3 -g  -DPREVENT_OPTIMIZATION  line 21 i
== v + 1
+FAIL: gcc.dg/guality/pr54693-2.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 21 i == v + 1
+FAIL: gcc.dg/guality/pr54693.c   -O1  -DPREVENT_OPTIMIZATION  line 22 i == c -
48
+FAIL: gcc.dg/guality/pr54693.c   -O2  -DPREVENT_OPTIMIZATION  line 22 i == c -
48
+FAIL: gcc.dg/guality/pr54693.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 22 i ==
c - 48
+FAIL: gcc.dg/guality/pr54693.c   -O3 -g  -DPREVENT_OPTIMIZATION  line 22 i ==
c - 48
+FAIL: gcc.dg/guality/pr54693.c   -Os  -DPREVENT_OPTIMIZATION  line 22 i == c -
48
+FAIL: gcc.dg/guality/pr54693.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 22 i == c - 48
+FAIL: gcc.dg/guality/pr54693.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 22 i == c - 48
+FAIL: gcc.dg/guality/pr89463.c   -O1  -DPREVENT_OPTIMIZATION  line 23 i + 1 ==
7
+FAIL: gcc.dg/guality/pr90074.c   -O1  -DPREVENT_OPTIMIZATION  line 28 i + 1 ==
8
+FAIL: gcc.dg/guality/pr90074.c   -O1  -DPREVENT_OPTIMIZATION  line 28 c + 1 ==
2
+FAIL: gcc.dg/guality/pr90716.c   -O1  -DPREVENT_OPTIMIZATION  line 23 j + 1 ==
9
+FAIL: gcc.dg/guality/pr90716.c   -O2  -DPREVENT_OPTIMIZATION  line 23 j + 1 ==
9
+FAIL: gcc.dg/guality/pr90716.c   -Os  -DPREVENT_OPTIMIZATION  line 23 j + 1 ==
9
+FAIL: gcc.dg/guality/pr90716.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  -DPREVENT_OPTIMIZATION line 23 j + 1 == 9
+FAIL: gcc.dg/guality/vla-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 17 sizeof (a) == 6

so confirmed some cases reported in this PR are still there.