diff mbox

add a gimple test for PR21458

Message ID 20161031072608.32001-1-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org Oct. 31, 2016, 7:26 a.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

A demonstration we can do the same thing with a gimple test as -fno-tree-evrp but somewhat more precisely.

I tested this passes on x86_64-linux-gnu, ok?

Trev

gcc/testsuite/ChangeLog:

2016-10-31  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* gcc.dg/tree-ssa/pr21458-3.c: New test.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c | 40 +++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c

Comments

Richard Biener Oct. 31, 2016, 9:32 a.m. UTC | #1
On Mon, Oct 31, 2016 at 8:26 AM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> A demonstration we can do the same thing with a gimple test as -fno-tree-evrp but somewhat more precisely.
>
> I tested this passes on x86_64-linux-gnu, ok?

Looks good to me with the indentation fixed (once the FE is on trunk).

Note that as the startwith 'vrp1' doesn't necessarily correspond to
the dumpfile 'vrp1' the pass specification
might be somewhat fragile...  it would require some more refactoring to make the
dumpfile name of a pass easily accessible from struct pass * to make a
match to that
(but then the startwith choice is to make it work with any pass
re-ordering as well).  I think
we support just -fdump-tree-vrp and using "vrp" in the
scan-tree-dump-times line as well?
Though I don't remember what the semantics is of those if we have
multiple vrp dumps.

Richard.

> Trev
>
> gcc/testsuite/ChangeLog:
>
> 2016-10-31  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
>         * gcc.dg/tree-ssa/pr21458-3.c: New test.
> ---
>  gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c | 40 +++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c
>
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c
> new file mode 100644
> index 0000000..6433a7e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c
> @@ -0,0 +1,40 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fgimple -fdump-tree-vrp1" } */
> +
> +extern void g (void);
> +extern void bar (int);
> +
> +int __GIMPLE(startwith("vrp1"))
> +foo (int a)
> +{
> +    int i;
> +
> +      bb_2:
> +      i_4 = 1;
> +        goto bb_6;
> +
> +         bb_3:
> +         if (i_1 != 0)
> +               goto bb_4;
> +           else
> +                 goto bb_5;
> +
> +             bb_4:
> +             g ();
> +
> +               bb_5:
> +               i_7 = i_1 + 1;
> +
> +                 bb_6:
> +                 i_1 = __PHI (bb_2: i_4, bb_5: i_7);
> +                   if (i_1 <= 99)
> +                         goto bb_3;
> +                     else
> +                           goto bb_7;
> +
> +                       bb_7:
> +                       return;
> +
> +}
> +
> +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */
> --
> 2.9.3.dirty
>
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c
new file mode 100644
index 0000000..6433a7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-3.c
@@ -0,0 +1,40 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -fgimple -fdump-tree-vrp1" } */
+
+extern void g (void);
+extern void bar (int);
+
+int __GIMPLE(startwith("vrp1"))
+foo (int a)
+{
+    int i;
+
+      bb_2:
+      i_4 = 1;
+        goto bb_6;
+
+	  bb_3:
+	  if (i_1 != 0)
+	        goto bb_4;
+	    else
+	          goto bb_5;
+
+	      bb_4:
+	      g ();
+
+	        bb_5:
+	        i_7 = i_1 + 1;
+
+		  bb_6:
+		  i_1 = __PHI (bb_2: i_4, bb_5: i_7);
+		    if (i_1 <= 99)
+		          goto bb_3;
+		      else
+			    goto bb_7;
+
+		        bb_7:
+		        return;
+
+}
+
+/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */