diff mbox

Enhance dump_probability function.

Message ID 20170614063103.GO2099@tucnak
State New
Headers show

Commit Message

Jakub Jelinek June 14, 2017, 6:31 a.m. UTC
On Wed, Jun 14, 2017 at 07:52:10AM +0200, Rainer Orth wrote:
> both revised scan-tree-dump patterns got the quoting wrong, leading to
> attempts to run unknown procs ^\\: instead of matching [^:] ;-(
> 
> This totally broke make check-gcc: the affected partial test runs
> aborted at that point, leading to gcc.{sum,log} files that make
> contrib/dg-extract-results.py choke, producing empty combined
> gcc.{sum,log} files.  No idea how this was tested (probably not at all).
> 
> The following patch fixes the syntax error
> 

> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
> --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
> @@ -290,7 +290,7 @@ RNG (0,  6,   8, "%s%ls", "1", L"2");
>  
>  /*  Only conditional calls to must_not_eliminate must be made (with
>      any probability):
> -    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]\\ \\\[count:\\[^:\\]*\\\]:\n *must_not_eliminate" 127 "optimized" { target { ilp32 || lp64 } } } }
> -    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]\\ \\\[count:\\[^:\\]*\\\]:\n *must_not_eliminate" 96 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } }
> +    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]\\ \\\[count:\\\[^:\\]*\\\]:\n *must_not_eliminate" 127 "optimized" { target { ilp32 || lp64 } } } }
> +    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]\\ \\\[count:\\\[^:\\]*\\\]:\n *must_not_eliminate" 96 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } }
>      No unconditional calls to abort should be made:
>      { dg-final { scan-tree-dump-not ";\n *must_not_eliminate" "optimized" } } */
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp101.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp101.c
> --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp101.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp101.c
> @@ -10,4 +10,4 @@ int main ()
>    return 0;
>  }
>  
> -/* { dg-final { scan-tree-dump "<bb 2> \\\[\[0-9.\]+%\\\] \\\[count: \\[^:\\]*\\\]:\[\n\r \]*return 0;" "optimized" } } */
> +/* { dg-final { scan-tree-dump "<bb 2> \\\[\[0-9.\]+%\\\] \\\[count: \\\[^:\\]*\\\]:\[\n\r \]*return 0;" "optimized" } } */

> 
> but both tests still come out as FAIL:
> 
> +FAIL: gcc.dg/tree-ssa/builtin-sprintf-2.c scan-tree-dump-times optimized "> \\\
> \[[0-9.]+%\\\\]\\\\ \\\\[count:\\\\[^:\\\\]*\\\\]:\\n *must_not_eliminate" 127
> 
> +FAIL: gcc.dg/tree-ssa/vrp101.c scan-tree-dump optimized "<bb 2> \\\\[[0-9.]+%\\
> \\] \\\\[count: \\\\[^:\\\\]*\\\\]:[\\n\\r ]*return 0;"
> 
> Martin should check what he really meant to match here and fix the
> patterns accordingly.

I've looked at the patch and committed following change that makes
both tests pass.  Scanning for [^:]* is weird, it would make more sense
to scan for [^]]*, but as only [0-9INV]* can appear there, I think it
doesn't hurt to be more precise.

2017-06-14  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/tree-ssa/vrp101.c: Fix scan-tree-dump regex.
	* gcc.dg/tree-ssa/builtin-sprintf-2.c: Likewise.  Adjust comment.



	Jakub

Comments

Martin Liška June 14, 2017, 7:14 a.m. UTC | #1
On 06/14/2017 08:31 AM, Jakub Jelinek wrote:
> I've looked at the patch and committed following change that makes
> both tests pass.  Scanning for [^:]* is weird, it would make more sense
> to scan for [^]]*, but as only [0-9INV]* can appear there, I think it
> doesn't hurt to be more precise.

Yes, we can be more precise. Thanks for the fix.

Martin
diff mbox

Patch

--- gcc/testsuite/gcc.dg/tree-ssa/vrp101.c.jj	2017-06-13 22:01:36.000000000 +0200
+++ gcc/testsuite/gcc.dg/tree-ssa/vrp101.c	2017-06-14 08:22:36.296814015 +0200
@@ -10,4 +10,4 @@  int main ()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump "<bb 2> \\\[\[0-9.\]+%\\\] \\\[count: \\[^:\\]*\\\]:\[\n\r \]*return 0;" "optimized" } } */
+/* { dg-final { scan-tree-dump "<bb 2> \\\[\[0-9.\]+%\\\] \\\[count: \[0-9INV\]*\\\]:\[\n\r \]*return 0;" "optimized" } } */
--- gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c.jj	2017-06-13 22:01:36.000000000 +0200
+++ gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c	2017-06-14 08:22:10.055149125 +0200
@@ -279,18 +279,18 @@  RNG (0,  6,   8, "%s%ls", "1", L"2");
    <bb 2>:
    result_3 = __builtin_sprintf (&MEM[(void *)&buf8k + 8192B], "%c", 32);
    if (result_3 != 0)
-     goto <bb 3>; [50.0%]
+     goto <bb 3>; [50.0%] [count: INV]
    else
-     goto <bb 4>; [50.0%]
+     goto <bb 4>; [50.0%] [count: INV]
 
-   <bb 3>[50.0%]:
+   <bb 3>[50.0%] [count: INV]:
    must_not_eliminate ();
 
 */
 
 /*  Only conditional calls to must_not_eliminate must be made (with
     any probability):
-    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]\\ \\\[count:\\[^:\\]*\\\]:\n *must_not_eliminate" 127 "optimized" { target { ilp32 || lp64 } } } }
-    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]\\ \\\[count:\\[^:\\]*\\\]:\n *must_not_eliminate" 96 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } }
+    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\] \\\[count: \[0-9INV\]*\\\]:\n *must_not_eliminate" 127 "optimized" { target { ilp32 || lp64 } } } }
+    { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\] \\\[count: \[0-9INV\]*\\\]:\n *must_not_eliminate" 96 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } }
     No unconditional calls to abort should be made:
     { dg-final { scan-tree-dump-not ";\n *must_not_eliminate" "optimized" } } */