From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10482 invoked by alias); 8 Jun 2011 09:45:27 -0000 Received: (qmail 10474 invoked by uid 22791); 8 Jun 2011 09:45:27 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from smtp-vbr5.xs4all.nl (HELO smtp-vbr5.xs4all.nl) (194.109.24.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Jun 2011 09:45:10 +0000 Received: from [192.168.1.68] (teejay.xs4all.nl [213.84.119.160]) (authenticated bits=0) by smtp-vbr5.xs4all.nl (8.13.8/8.13.8) with ESMTP id p589j7H7086050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jun 2011 11:45:08 +0200 (CEST) (envelope-from vries@codesourcery.com) Message-ID: <4DEF44C1.4070800@codesourcery.com> Date: Wed, 08 Jun 2011 09:55:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Richard Guenther CC: Steven Bosscher , gcc-patches@gcc.gnu.org Subject: [PATCH, PR43864] Gimple level duplicate block cleanup - test cases. References: <4DEF4408.4040001@codesourcery.com> In-Reply-To: <4DEF4408.4040001@codesourcery.com> Content-Type: multipart/mixed; boundary="------------080401010909050201080703" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00627.txt.bz2 This is a multi-part message in MIME format. --------------080401010909050201080703 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 273 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 PR middle-end/43864 * gcc.dg/pr43864.c: New test. * gcc.dg/pr43864-2.c: New test. --------------080401010909050201080703 Content-Type: text/x-patch; name="pr43864.test.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pr43864.test.patch" Content-length: 1501 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 +#include + +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" } } */ --------------080401010909050201080703--