diff mbox series

[COMMITTED] Testcase adjustments for pass vrp1.

Message ID 922e773e-921b-333f-6540-e61f42612a58@redhat.com
State Committed
Headers show
Series [COMMITTED] Testcase adjustments for pass vrp1. | expand

Commit Message

Andrew MacLeod Nov. 3, 2021, 2:39 p.m. UTC
The following tests all were checking something specific in VRP1 and 
with multiple versions available to run now, this patch unifies the 
checking so that they still check what it did before, verify the same 
code is produced, but does it in a more agnostic way.  This allows them 
to pass with both --param=vrp1-mode=vrp and --param=vrp1-mode=ranger.

Specifically:

* pr23744.c: don;'t look for the phrase "gimple_simplified", and ranger 
produces a "Folding predicate" from the propagation engine. Instead, 
verify that that here is exactly 1 "return 0" and no "return 1"s in the 
results.

* vrp07.c: Don't look for the number of  "PREDICATE: p_" asserts that 
were inserted, the "Folding predicate" checks themselves are enough.

* vrp08.c: Same thing. no need to verify the number of PREDICATE asserts.

* vrp09.c: Change the
      scan-tree-dump-times "Folding predicate p_.. != 0B to 1" 2 "vrp1"
into 2 similar cehcks that allow for the difference in output that 
p_10(D) doesn't fit that pattern.  This also seems to show either a bug 
in dejagnu, or a lack in my understanding of wildcards... because 
allowing for the (D) at the end of p_10 implemented with a wildcard will 
not match more than 1 time.  I ran across this a couple of times, and 
notice there are no testacses which look for a '*' wildcard using 
scan-tree-dump-times with a value greater than 1... ie
      scan-tree-dump-times "Folding predicate p_\.\* != 0B to 1" 1 "vrp1"
Will match the sequence if it happens once in the file, but if it 
happens twice, and you use
      scan-tree-dump-times "Folding predicate p_\.\* != 0B to 1" 2 "vrp1"
It fails to match... Im not getting into that at the moment, so I simply 
added 2 checks without wildcards that work out to the equivalent thing.

* vrp20.c: Adjust the checks to again allow for a possible (D) following 
the ssa_name in the listing.

* vrp92.c: This testcase checked that an ssa_name specifically was given 
a global value of [1,1], and that no threading occurred.  Well, res 
actually folded away, and ranger doesn export globals values for 
ssa-names which no longer exist.  INstead , changes the checks to make 
sure that the resulting code from vrp1 has no PHIs, Ifs, or gotos.

* jit.dg/test-sum-of-squares.c: The original was checking for a symbolic 
range.. Dmalcolm adjusted the testcase for me to accomplish his original 
goal without depending on symbolics. Thanks!!

no regressions on x86_64-pc-linux-gnu,  pushed.

Andrew
diff mbox series

Patch

From 1410b208013e4ccd9438cda178c7ea995684e7e8 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Mon, 1 Nov 2021 16:20:23 -0400
Subject: [PATCH 5/6] Testcase adjustments for pass vrp1.

Unify testcases for the vrp1 pass so they will work with the output from either
VRP or ranger.

	gcc/testsuite/
	* gcc.dg/tree-ssa/pr23744.c: Tweak output checks.
	* gcc.dg/tree-ssa/vrp07.c: Ditto.
	* gcc.dg/tree-ssa/vrp08.c: Ditto.
	* gcc.dg/tree-ssa/vrp09.c: Ditto.
	* gcc.dg/tree-ssa/vrp20.c: Ditto.
	* gcc.dg/tree-ssa/vrp92.c: Ditto.
	* jit.dg/test-sum-of-squares.c: Ditto.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr23744.c    |  5 +++--
 gcc/testsuite/gcc.dg/tree-ssa/vrp07.c      |  3 ---
 gcc/testsuite/gcc.dg/tree-ssa/vrp08.c      |  1 -
 gcc/testsuite/gcc.dg/tree-ssa/vrp09.c      |  3 ++-
 gcc/testsuite/gcc.dg/tree-ssa/vrp20.c      |  4 ++--
 gcc/testsuite/gcc.dg/tree-ssa/vrp92.c      |  7 ++++---
 gcc/testsuite/jit.dg/test-sum-of-squares.c | 10 +++++-----
 7 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c
index ba3fda352ca..f70f2546bf1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdisable-tree-evrp -fdump-tree-vrp1" } */
 
 void h (void);
 
@@ -17,4 +17,5 @@  int g (int i, int j)
     return 1;
 }
 
-/* { dg-final { scan-tree-dump-times "gimple_simplified" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "return 0" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "return 1" "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
index 9c4acd29681..ec5f6cce46f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
@@ -34,6 +34,3 @@  foo (int i, int *p)
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
-
-/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 2 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
-/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 1 "vrp1" { target {   keeps_null_pointer_checks } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
index 4599fa7d533..c9d90236715 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
@@ -20,5 +20,4 @@  foo (int a, int *p)
 }
 /* Target disabling -fdelete-null-pointer-checks should not fold checks */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
-/* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c
index 4e4954da32a..354169692d6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c
@@ -27,4 +27,5 @@  L78:
     }
 }
 
-/* { dg-final { scan-tree-dump-times "Folding predicate p_.. != 0B to 1" 2 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Folding predicate p_" 2 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "!= 0B to 1" 2 "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c
index f9df67ffb05..e5822992fe4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c
@@ -23,5 +23,5 @@  int g (int b) {
 	return 1;
 }
 
-/* { dg-final { scan-tree-dump "Folding predicate a_. == 0 to 0" "vrp1" } } */
-/* { dg-final { scan-tree-dump "Folding predicate b_. != 0 to 1" "vrp1" } } */
+/* { dg-final { scan-tree-dump "Folding predicate a_\.\* == 0 to 0" "vrp1" } } */
+/* { dg-final { scan-tree-dump "Folding predicate b_\.\* != 0 to 1" "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c
index 66d74e9b5e9..9e53547dadc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-fre -fdump-tree-vrp1-details -fdisable-tree-ethread" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-fre -fdump-tree-vrp1 -fdisable-tree-ethread" } */
 
 void bar (void);
 int foo (int i, int j)
@@ -18,5 +18,6 @@  int foo (int i, int j)
   return j;
 }
 
-/* { dg-final { scan-tree-dump "res_.: int \\\[1, 1\\\]" "vrp1" } } */
-/* { dg-final { scan-tree-dump-not "Threaded" "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "PHI" "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "goto" "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "if" "vrp1" } } */
diff --git a/gcc/testsuite/jit.dg/test-sum-of-squares.c b/gcc/testsuite/jit.dg/test-sum-of-squares.c
index f095f419a59..cfcf5b2aac2 100644
--- a/gcc/testsuite/jit.dg/test-sum-of-squares.c
+++ b/gcc/testsuite/jit.dg/test-sum-of-squares.c
@@ -133,10 +133,10 @@  verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
      An example of using gcc_jit_context_enable_dump to verify a property
      of the compile.
 
-     In this case, verify that vrp is able to deduce the
-     bounds of the iteration variable. Specifically, verify that some
-     variable is known to be in the range negative infinity to some
-     expression based on param "n" (actually n-1).  */
-  CHECK_STRING_CONTAINS (dump_vrp1, "[-INF, n_");
+     In particular, this example verifies that we can read the dump from a
+     pass with multiple instances.  Given that the format of the VRP dump
+     is subject to change, merely verify that it contains the function
+     name.  */
+  CHECK_STRING_CONTAINS (dump_vrp1, ";; Function loop_test");
   free (dump_vrp1);
 }
-- 
2.17.2