This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[testsuite, committed] Make scan pattern more precise in vrp104.c


[ was: Re: [PATCH][RFC] Make expansion of balanced binary trees of switches on tree level. ]

On 08/30/2017 01:10 PM, Martin Liška wrote:
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c
index aa3b00a1204..0a952267b29 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c
@@ -1,6 +1,8 @@
  /* PR tree-optimization/18046  */
-/* { dg-options "-O2 -fdump-tree-optimized" }  */
-/* { dg-final { scan-tree-dump-times "switch" 1 "switchlower" } }  */
+/* { dg-options "-O2 -fdump-tree-switchlower" }  */
+/* We scan for 2 switches as the dump file reports a transformation,
+   IL really contains just a single.  */
+/* { dg-final { scan-tree-dump-times "switch" 2 "switchlower" } }  */
void foo (void);
  void bar (void);


A difference between the optimized and switchlower dumps, is that the switchlower dump contains a source file path:
...
;; Function test (test, funcdef_no=0, decl_uid=1964, cgraph_uid=0, symbol_order=0)

beginning to process the following SWITCH statement (/home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c:14) : ------- switch (i_3(D)) <default: <L13> [33.33%], case 1: <L0> [33.33%], case 2: <L1> [33.33%]>

test (int i)
{
  <bb 2> [local count: 1073741825]:
switch (i_3(D)) <default: <L13> [33.33%], case 1: <L0> [33.33%], case 2: <L1> [33.33%]>
...

So, when I build and tested gcc in a directory containing the string switch, the scan check failed for me, because it triggered 3 times instead of 2:
...
gcc.dg/tree-ssa/vrp104.c: pattern found 3 times
FAIL: gcc.dg/tree-ssa/vrp104.c scan-tree-dump-times switchlower "switch" 2
...

Fixed by making the scan pattern more precise.

[ The generic form of this problem is filed as PR82806 - Stabilize paths in assembler and dumps ]

Committed.

Thanks,
- Tom
[testsuite] Make scan pattern more precise in vrp104.c

2018-03-24  Tom de Vries  <tom@codesourcery.com>

	* gcc.dg/tree-ssa/vrp104.c: Make scan-tree-dump-times pattern more
	precise.

---
 gcc/testsuite/gcc.dg/tree-ssa/vrp104.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c
index 0a95226..d4691fc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp104.c
@@ -2,7 +2,7 @@
 /* { dg-options "-O2 -fdump-tree-switchlower" }  */
 /* We scan for 2 switches as the dump file reports a transformation,
    IL really contains just a single.  */
-/* { dg-final { scan-tree-dump-times "switch" 2 "switchlower" } }  */
+/* { dg-final { scan-tree-dump-times "switch \\(i_" 2 "switchlower" } }  */
 
 void foo (void);
 void bar (void);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]