From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118550 invoked by alias); 21 Mar 2018 12:40:15 -0000 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 Received: (qmail 118541 invoked by uid 89); 21 Mar 2018 12:40:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Mar 2018 12:40:12 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9BE45AFB6; Wed, 21 Mar 2018 12:40:10 +0000 (UTC) Subject: Re: [PATCH] Fix compile-time hog in MPX boundary checking (PR target/84988). From: =?UTF-8?Q?Martin_Li=c5=a1ka?= To: Richard Biener , Jeff Law , GCC Patches , Richard Sandiford , Ilya Enkovich References: <87a7v2zak7.fsf@linaro.org> <7d705ae8-8c44-d9d6-7c28-0a5c8e61cea6@suse.cz> Message-ID: <14d2a4b4-bb13-bc26-1659-ddb6d17bc2f1@suse.cz> Date: Wed, 21 Mar 2018 12:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <7d705ae8-8c44-d9d6-7c28-0a5c8e61cea6@suse.cz> Content-Type: multipart/mixed; boundary="------------A0F597A394AE28EC24D085A6" X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg01095.txt.bz2 This is a multi-part message in MIME format. --------------A0F597A394AE28EC24D085A6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-length: 2723 On 03/21/2018 10:39 AM, Martin LiÅ¡ka wrote: > On 03/21/2018 10:36 AM, Richard Biener wrote: >> On Tue, Mar 20, 2018 at 10:44 PM, Richard Sandiford >> wrote: >>> Jeff Law writes: >>>> On 03/20/2018 01:36 PM, Martin LiÅ¡ka wrote: >>>>> Hi. >>>>> >>>>> This is a work-around to not iterate all members of array that can be huge. >>>>> As MPX will be removed in GCC 9.x, I hope it's acceptable. I don't want >>>>> to come >>>>> up with a new param for it. >>>>> >>>>> Survives tests&bootstrap on x86_64-linux-gnu. >>>>> >>>>> Martin >>>>> >>>>> gcc/ChangeLog: >>>>> >>>>> 2018-03-20  Martin Liska  >>>>> >>>>>      PR target/84988 >>>>>      * tree-chkp.c (CHKP_ARRAY_MAX_CHECK_STEPS): Define a new macro. >>>>>      (chkp_find_bound_slots_1): Limit number of iterations. >>>> Or just CLOSE/WONTFIX :-) >>>> >>>> I've got no objections here -- we want to  minimize the effort put into >>>> CHKP given its going to be deprecated. >>> >>> The problem is that this affects normal configs, not just ones with >>> MPX enabled. >> >> Indeed.  It get's called via >> >> #0  chkp_find_bound_slots_1 (type=0x7ffff69ee9d8, have_bound=0x2ed3868, offs=0) >>      at /space/rguenther/src/svn/early-lto-debug/gcc/tree-chkp.c:1708 >> #1  0x0000000001379a13 in chkp_find_bound_slots (type=0x7ffff69ee9d8, >>      res=0x2ed3868) >>      at /space/rguenther/src/svn/early-lto-debug/gcc/tree-chkp.c:1754 >> #2  0x0000000001377054 in chkp_type_bounds_count (type=0x7ffff69ee9d8) >>      at /space/rguenther/src/svn/early-lto-debug/gcc/tree-chkp.c:1009 >> #3  0x00000000016c664f in ix86_function_arg_advance (cum_v=..., >>      mode=E_BLKmode, type=0x7ffff69ee9d8, named=true) >>      at /space/rguenther/src/svn/early-lto-debug/gcc/config/i386/i386.c:8621 >> 8616        { >> 8617          /* Track if there are outgoing arguments on stack.  */ >> 8618          if (cum->caller) >> 8619            cfun->machine->outgoing_args_on_stack = true; >> 8620 >> 8621          cum->bnds_in_bt = chkp_type_bounds_count (type); >> 8622        } >> 8623    } >> 8624 >> 8625    /* Define where to put the arguments to a function. >> >> but I think we know POINTER_BOUNDS_TYPE_P etc. never return >> true if -fcheck-pointer-* or -mmpx is not enabled, right?  So we can >> guard the above call appropriately and save some compile-time >> for all of us? > > Good observation, let me enhance the patch for the PR. > > Martin > >> >> Richard. >> >>> Thanks, >>> Richard > Hi. I've got this, that survives bootstrap®ression tests on x86_64-linux-gnu. May I install it? Thanks, Martin --------------A0F597A394AE28EC24D085A6 Content-Type: text/x-patch; name="0001-Do-not-call-chkp_type_bounds_count-if-MPX-is-not-ena.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Do-not-call-chkp_type_bounds_count-if-MPX-is-not-ena.pa"; filename*1="tch" Content-length: 1011 >From 15f95ac5117d9e2bab96c725716e5cb2832d3589 Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 21 Mar 2018 10:51:32 +0100 Subject: [PATCH] Do not call chkp_type_bounds_count if MPX is not enabled (PR target/84988). gcc/ChangeLog: 2018-03-21 Martin Liska PR target/84988 * config/i386/i386.c (ix86_function_arg_advance): Do not call chkp_type_bounds_count if MPX is not enabled. --- gcc/config/i386/i386.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5b1e962dedb..0693f8fc451 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8618,7 +8618,8 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, if (cum->caller) cfun->machine->outgoing_args_on_stack = true; - cum->bnds_in_bt = chkp_type_bounds_count (type); + if (type && POINTER_BOUNDS_TYPE_P (type)) + cum->bnds_in_bt = chkp_type_bounds_count (type); } } -- 2.16.2 --------------A0F597A394AE28EC24D085A6--