From patchwork Wed Nov 26 13:48:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 415126 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6400214017A for ; Thu, 27 Nov 2014 00:48:32 +1100 (AEDT) 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:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=NRnG2n3RzUaYr2j5N I8MeOXNxSLeM47uLNQkd8hL2CA5CoZyzHy3qMiNKd5W5OQg5cZTwNO4Xus8RKftW VKwf167QbNLQ4PHTfyVpPoWcbRVCG3XVmW75VICHDeCSgPWD217rlCa8Gj78sr5n zkgGRwCmoUu/fY4DIYJwsEhvZk= 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:references:mime-version :content-type:in-reply-to; s=default; bh=s1if8kOll1a8nvP8EMPlZqo PDbI=; b=PBqOpMhVBT9WcbfT6RO4l2kaGddatUcvWpoG31VPPPicBn2suSv7KN3 5NOidKPf8AJLGcNI4wKqe+vsYWjF6OpeAatBgr0PLzKBhdUB/ULYMNtrYh7j26Xs ERFdVWFH3HHIBWurdwXi5uDW7UV+Cp0BD9g4u1eB1+G0yEYX2OGU= Received: (qmail 5820 invoked by alias); 26 Nov 2014 13:48:24 -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 5810 invoked by uid 89); 26 Nov 2014 13:48:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f170.google.com Received: from mail-pd0-f170.google.com (HELO mail-pd0-f170.google.com) (209.85.192.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 26 Nov 2014 13:48:22 +0000 Received: by mail-pd0-f170.google.com with SMTP id fp1so2842351pdb.15 for ; Wed, 26 Nov 2014 05:48:20 -0800 (PST) X-Received: by 10.66.241.202 with SMTP id wk10mr54254432pac.88.1417009700688; Wed, 26 Nov 2014 05:48:20 -0800 (PST) Received: from msticlxl57.ims.intel.com ([192.55.55.41]) by mx.google.com with ESMTPSA id ap5sm4448566pad.22.2014.11.26.05.48.17 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Nov 2014 05:48:20 -0800 (PST) Date: Wed, 26 Nov 2014 16:48:13 +0300 From: Ilya Enkovich To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix PR bootstrap/63995 Message-ID: <20141126134311.GD40854@msticlxl57.ims.intel.com> References: <20141126124146.GC40854@msticlxl57.ims.intel.com> <20141126124620.GG1669@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141126124620.GG1669@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On 26 Nov 13:46, Jakub Jelinek wrote: > On Wed, Nov 26, 2014 at 03:41:46PM +0300, Ilya Enkovich wrote: > > Hi, > > > > This patch makes optimization for bounds lifetime reduction to ignore > > debug stetments. This fixes stage2 and stage3 comparision for > > instrumented boostrap. OK for trunk? > > Please add a small testcase (with -fcompare-debug -fcheck-pointer-bounds (or what > other options you need to reproduce it) that fails without the patch and > succeeds with it. > > > 2014-11-26 Ilya Enkovich > > > > PR bootstrap/63995 > > * tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Ignore > > debug statement when searching for a new position for > > bounds load/creation statement. > > > > > > diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c > > index ff390d7..92e0694 100644 > > --- a/gcc/tree-chkp-opt.c > > +++ b/gcc/tree-chkp-opt.c > > @@ -1175,6 +1175,9 @@ chkp_reduce_bounds_lifetime (void) > > > > FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, op) > > { > > + if (is_gimple_debug (use_stmt)) > > + continue; > > + > > if (dom_bb && > > dominated_by_p (CDI_DOMINATORS, > > dom_bb, gimple_bb (use_stmt))) > > Jakub Here is a version with a test added. Thanks, Ilya --- gcc/ 2014-11-26 Ilya Enkovich PR bootstrap/63995 * tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Ignore debug statement when searching for a new position for bounds load/creation statement. gcc/testsuite/ 2014-11-26 Ilya Enkovich PR bootstrap/63995 * gcc.target/i386/pr63995-2.c: New. diff --git a/gcc/testsuite/gcc.target/i386/pr63995-2.c b/gcc/testsuite/gcc.target/i386/pr63995-2.c new file mode 100644 index 0000000..7c22e62 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr63995-2.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mpx } */ +/* { dg-options "-O2 -g -fcheck-pointer-bounds -mmpx -fcompare-debug" } */ + +struct ts +{ + int field; +}; + +extern void test1 (); +extern void test2 (struct ts *); + +static void +init (struct ts *c) +{ + c->field = -1; +} + +struct ts +test3 (const struct ts *other) +{ + struct ts r; + if (other->field != 0) + test1 (); + init (&r); + test2 (&r); + return r; +} diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c index ff390d7..92e0694 100644 --- a/gcc/tree-chkp-opt.c +++ b/gcc/tree-chkp-opt.c @@ -1175,6 +1175,9 @@ chkp_reduce_bounds_lifetime (void) FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, op) { + if (is_gimple_debug (use_stmt)) + continue; + if (dom_bb && dominated_by_p (CDI_DOMINATORS, dom_bb, gimple_bb (use_stmt)))