From patchwork Wed Jun 8 09:45:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 99388 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 879FBB6FE6 for ; Wed, 8 Jun 2011 19:45:29 +1000 (EST) 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 11:45:37 +0200 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> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. 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" } } */