From patchwork Wed Jun 12 12:23:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 250749 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7938B2C0095 for ; Wed, 12 Jun 2013 22:23:51 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=WuSE2cZfCJ5n1kXRvHZbUyZ/EqKS3SFVOmGi3ZScwNyCdZrG78 frGvplOyWp3xzBLc3g9ZVMWc6rGvAdFFZaOXNJaFkiJtMloB1YOjA9eXviFW82X5 DhDc/b5Mu4D52nWd/4z5+M15GzcvEil6i2kxp3q1b/AYu1YjkWvsd6BNM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=TVQNyoea9oiUIwg75vNm9zCvN5I=; b=BTJrU7DcVzsKspt8a40f NxEZlw6CstX4/R8BpxRZxW5omB5edjyfdL2D36eH2N5nWVGxmkyytg7CY6ZD2vVg wAWbmLQBU8KpEznH7VDsVSDmCcXkhVoTRL9QZCrPuju9xQuhyC99h5ifnvmUMW7I IUhQLOqrV4syn/jqdYYhYYY= Received: (qmail 18129 invoked by alias); 12 Jun 2013 12:23:45 -0000 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 Received: (qmail 18119 invoked by uid 89); 12 Jun 2013 12:23:44 -0000 X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, TW_TM autolearn=ham version=3.3.1 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 12 Jun 2013 12:23:43 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E8264A555A; Wed, 12 Jun 2013 14:23:41 +0200 (CEST) Date: Wed, 12 Jun 2013 14:23:41 +0200 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH, 4.8, PR57358] Check if optimizing in parm_ref_data_preserved_p Message-ID: <20130612122341.GD26236@virgil.suse> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, this is the simplest fix for the PR which happens because there is no VDEF on a stmt if a particular function is not optimized. I'd like to fix the bug with it on the branch. Bootstrapped and tested on x86_64-linux. OK? Thanks, Martin 2013-06-11 Martin Jambor PR tree-optimization/57358 * ipa-prop.c (parm_ref_data_preserved_p): Always return true when not optimizing. testsuite/ * gcc.dg/ipa/pr57358.c: New test. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 53cd5ed..c62dc68 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -678,13 +678,19 @@ parm_ref_data_preserved_p (struct param_analysis_info *parm_ainfo, bool modified = false; ao_ref refd; - gcc_checking_assert (gimple_vuse (stmt)); if (parm_ainfo && parm_ainfo->ref_modified) return false; - ao_ref_init (&refd, ref); - walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified, - NULL); + if (optimize) + { + gcc_checking_assert (gimple_vuse (stmt)); + ao_ref_init (&refd, ref); + walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified, + NULL); + } + else + modified = true; + if (parm_ainfo && modified) parm_ainfo->ref_modified = true; return !modified; diff --git a/gcc/testsuite/gcc.dg/ipa/pr57358.c b/gcc/testsuite/gcc.dg/ipa/pr57358.c new file mode 100644 index 0000000..c83396f --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr57358.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct t { void (*func)(void*); }; +void test_func(struct t* a) __attribute__((optimize("O0"))); +void test_func(struct t* a) +{ + a->func(0); +}