Patchwork [PR43864] Gimple level duplicate block cleanup - test cases.

login
register
mail settings
Submitter Tom de Vries
Date July 17, 2011, 6:33 p.m.
Message ID <4E232B0F.5040804@codesourcery.com>
Download mbox | patch
Permalink /patch/105081/
State New
Headers show

Comments

Tom de Vries - July 17, 2011, 6:33 p.m.
Updated version.

On 06/08/2011 11:45 AM, Tom de Vries wrote:
> On 06/08/2011 11:42 AM, Tom de Vries wrote:
> 
>> I'll send the patch with the testcases in a separate email.
> 

OK for trunk?

Thanks,
- Tom

2011-07-17  Tom de Vries  <tom@codesourcery.com>

	PR middle-end/43864
	* gcc.dg/fold-compare-2.c (dg-options): Add -fno-tree-tail-merge.
	* gcc/testsuite/gcc.dg/uninit-pred-2_c.c: Same.
	* gcc.dg/pr43864.c: New test.
	* gcc.dg/pr43864-2.c: Same.

Patch

Index: gcc/testsuite/gcc.dg/fold-compare-2.c
===================================================================
--- gcc/testsuite/gcc.dg/fold-compare-2.c	(revision 175801)
+++ gcc/testsuite/gcc.dg/fold-compare-2.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp" } */
+/* { dg-options "-O2 -fno-tree-tail-merge -fdump-tree-vrp" } */
 
 extern void abort (void);
 
Index: gcc/testsuite/gcc.dg/uninit-pred-2_c.c
===================================================================
--- gcc/testsuite/gcc.dg/uninit-pred-2_c.c	(revision 175801)
+++ gcc/testsuite/gcc.dg/uninit-pred-2_c.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-Wuninitialized -O2" } */
+/* { dg-options "-Wuninitialized -O2 -fno-tree-tail-merge" } */
 
 int g;
 void bar (void);
Index: gcc/testsuite/gcc.dg/pr43864.c
===================================================================
--- gcc/testsuite/gcc.dg/pr43864.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr43864.c	(revision 0)
@@ -0,0 +1,35 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+extern void foo (char*, int);
+extern void mysprintf (char *, char *);
+extern void myfree (void *);
+extern int access (char *, int);
+extern int fopen (char *, int);
+
+char *
+hprofStartupp (char *outputFileName, char *ctx)
+{
+  char fileName[1000];
+  int fp;
+  mysprintf (fileName, outputFileName);
+  if (access (fileName, 1) == 0)
+    {
+      myfree (ctx);
+      return 0;
+    }
+
+  fp = fopen (fileName, 0);
+  if (fp == 0)
+    {
+      myfree (ctx);
+      return 0;
+    }
+
+  foo (outputFileName, fp);
+
+  return ctx;
+}
+
+/* { dg-final { scan-tree-dump-times "myfree" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/pr43864-2.c
===================================================================
--- gcc/testsuite/gcc.dg/pr43864-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr43864-2.c	(revision 0)
@@ -0,0 +1,23 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int
+f (int c, int b, int d)
+{
+  int r, e;
+
+  if (c)
+    r = b + d;
+  else
+    {
+      e = b + d;
+      r = e;
+    }
+
+  return r;
+}
+
+/* { dg-final { scan-tree-dump-times "if " 0 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "\\\+" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "PHI" 0 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */