public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aldyh/heads/ranger-staging)] Adjusted and documented threading tests.
@ 2020-09-18 13:28 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2020-09-18 13:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:58b5c667ed3f1d1ef272349ade6563986209993e
commit 58b5c667ed3f1d1ef272349ade6563986209993e
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Fri Sep 18 15:26:41 2020 +0200
Adjusted and documented threading tests.
Adjusted ssa-dom-thread-[67].c so they match reality. Documented why
thread counts are different.
Documented changes in pr77445-2.c, but I'm still not sure what the
original failing message was checking for.
Diff:
---
gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c | 4 +++
gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c | 38 ++++++++++++++++++++++--
gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c | 27 ++++++++++++-----
3 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
index 9c22c538da8..2b0e3878e3f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
@@ -124,6 +124,10 @@ enum STATES FMS( u8 **in , u32 *transitions) {
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump "Jumps threaded: 1\[1-9\]" "thread1" } } */
+/* ?? I have no idea what this "Invalid sum" business was originally
+ checking for, but we are threading 6 more paths on x86_64 which is
+ obviously changing the IL in visible ways. FWIW, we are getting 6
+ "Invalid sum" messages instead of 3. */
/* { dg-final { scan-tree-dump-times "Invalid sum" 3 "thread1" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread1" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
index 551fbac3dad..47b6acdfd96 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
@@ -1,7 +1,41 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-thread2-details" } */
-/* { dg-final { scan-tree-dump-times "FSM" 3 "thread1" } } */
-/* { dg-final { scan-tree-dump-times "FSM" 5 "thread2" } } */
+
+/* All the threads in the thread1 dump start on a X->BB12 edge, as can
+ be seen in the dump:
+
+ Registering FSM jump thread: (x, 12) incoming edge; ...
+ etc
+ etc
+
+ Before evrp went hybrid, we were threading paths that started at
+ the following edges:
+
+ Registering FSM jump thread: (10, 12) incoming edge
+ Registering FSM jump thread: (6, 12) incoming edge
+ Registering FSM jump thread: (9, 12) incoming edge
+
+ This was because the PHI at BB12 had constant values coming in from
+ BB10, BB6, and BB9:
+
+ # state_10 = PHI <state_11(7), 0(10), state_11(5), 1(6), state_11(8), 2(9), state_11(11)>
+
+ Now with the hybrid evrp, we get:
+
+ # state_10 = PHI <0(7), 0(10), state_11(5), 1(6), 0(8), 2(9), 1(11)>
+
+ Thus, we have 3 more paths that are known to be constant and can be
+ threaded. Which means that by the second threading pass, we can
+ only find one profitable path.
+
+ For the record, all these extra constants are better paths coming
+ out of switches. For example:
+
+ SWITCH_BB -> BBx -> BBy -> BBz -> PHI
+
+ We now know the value of the switch index at PHI. */
+/* { dg-final { scan-tree-dump-times "FSM" 6 "thread1" } } */
+/* { dg-final { scan-tree-dump-times "FSM" 1 "thread2" } } */
int sum0, sum1, sum2, sum3;
int foo (char *s, char **ret)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index a3395578f78..bad5bc1d003 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -1,20 +1,31 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 16" "thread1" } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" } } */
+
+/* Here we have the same issue as was commented in ssa-dom-thread-6.c.
+ The PHI coming into the threader has a lot more constants, so the
+ threader can thread more paths.
+
+$ diff clean/a.c.105t.mergephi2 a.c.105t.mergephi2
+252c252
+< # s_50 = PHI <s_49(10), 5(14), s_51(18), s_51(22), 1(26), 1(29), 1(31), s_51(5), 4(12), 1(15), 5(17), 1(19), 3(21), 1(23), 6(25), 7(28), s_51(30)>
+---
+> # s_50 = PHI <s_49(10), 5(14), 4(18), 5(22), 1(26), 1(29), 1(31), s_51(5), 4(12), 1(15), 5(17), 1(19), 3(21), 1(23), 6(25), 7(28), 7(30)>
+272a273
+
+ I spot checked a few and they all have the same pattern. We are
+ basically tracking the switch index better through multiple
+ paths. */
+
+/* { dg-final { scan-tree-dump "Jumps threaded: 19" "thread1" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" } } */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2" } } */
+
/* aarch64 has the highest CASE_VALUES_THRESHOLD in GCC. It's high enough
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "vrp2" { target { ! aarch64*-*-* } } } } */
-/* Most architectures get 3 threadable paths here, whereas aarch64 and
- possibly others get 5. We really should rewrite threading tests to
- test a specific IL sequence, not gobs of code whose IL can vary
- from architecture to architecture. */
-/* { dg-final { scan-tree-dump "Jumps threaded: \[35\]" "thread3" } } */
-
enum STATE {
S0=0,
SI,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-18 13:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 13:28 [gcc(refs/users/aldyh/heads/ranger-staging)] Adjusted and documented threading tests Aldy Hernandez
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).