public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <vries@codesourcery.com>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: Steven Bosscher <stevenb.gcc@gmail.com>, gcc-patches@gcc.gnu.org
Subject: [PATCH, PR43864] Gimple level duplicate block cleanup - test cases.
Date: Wed, 08 Jun 2011 09:55:00 -0000	[thread overview]
Message-ID: <4DEF44C1.4070800@codesourcery.com> (raw)
In-Reply-To: <4DEF4408.4040001@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

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-06-08  Tom de Vries  <tom@codesourcery.com>

	PR middle-end/43864
	* gcc.dg/pr43864.c: New test.
	* gcc.dg/pr43864-2.c: New test.

[-- Attachment #2: pr43864.test.patch --]
[-- Type: text/x-patch, Size: 1501 bytes --]

Index: gcc/testsuite/gcc.dg/pr43864-2.c
===================================================================
--- /dev/null (new file)
+++ gcc/testsuite/gcc.dg/pr43864-2.c (revision 0)
@@ -0,0 +1,22 @@
+/* { 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" } } */
Index: gcc/testsuite/gcc.dg/pr43864.c
===================================================================
--- /dev/null (new file)
+++ gcc/testsuite/gcc.dg/pr43864.c (revision 0)
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void foo (char*, FILE*);
+
+char* hprofStartupp (char *outputFileName, char *ctx)
+{
+  char fileName[1000];
+  FILE *fp;
+  sprintf (fileName, outputFileName);
+  if (access (fileName, 1) == 0)
+    {
+      free (ctx);
+      return 0;
+    }
+
+  fp = fopen (fileName, 0);
+  if (fp == 0)
+    {
+      free (ctx);
+      return 0;
+    }
+
+  foo (outputFileName, fp);
+
+  return ctx;
+}
+
+/* { dg-final { scan-tree-dump-times "free" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */

  reply	other threads:[~2011-06-08  9:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  9:49 [PATCH, PR43864] Gimple level duplicate block cleanup Tom de Vries
2011-06-08  9:55 ` Tom de Vries [this message]
2011-07-18  2:54   ` [PATCH, PR43864] Gimple level duplicate block cleanup - test cases Tom de Vries
2011-08-19 18:38     ` Tom de Vries
2011-08-25 10:09       ` Richard Guenther
2011-06-08 10:09 ` [PATCH, PR43864] Gimple level duplicate block cleanup Richard Guenther
2011-06-08 10:40   ` Steven Bosscher
2011-06-10 17:16   ` Tom de Vries
2011-06-14 15:12     ` Richard Guenther
2011-07-12 12:21       ` Tom de Vries
2011-07-12 14:37         ` Richard Guenther
2011-07-18  0:41           ` Tom de Vries
2011-07-22 15:54             ` Richard Guenther
2011-08-19 18:33               ` Tom de Vries
2011-08-24  9:00               ` Tom de Vries
2011-08-25  1:07                 ` Ian Lance Taylor
2011-08-25  9:30                   ` Richard Guenther
2011-06-10 18:43 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DEF44C1.4070800@codesourcery.com \
    --to=vries@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=stevenb.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).