From patchwork Fri Jan 8 18:01:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 564983 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 473DF140BDA for ; Sat, 9 Jan 2016 05:01:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=bCl2shP9; dkim-atps=neutral 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=NqpwQvUnFT/CsNZyWF7SIfiEhYrIBTy6+EaWeW7XTl9GZNX/EJ eENlacFcs1CdhyB800pTQVM5Lb1yDrx/EWPm/W5PeUS2oGZf7RqdNakwXdIP7npS zrAldxKcBMsR3cvKjO7dvmgxscXGXA65ITZCB3LwCjq5XxL0Rvw4+8OX8= 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=xi9ahNLmzVBRmCk+Q3xH/R0pkhU=; b=bCl2shP9TAXAeWfA7tI/ 1YEU1FuGIj/uhE8IcpHH7JvZCj7yZQ6uvlp/6vXzUR8fJ8PDT2xSO5WCHSSEAf8+ an6Ova11Xu7gI4IPEKRIz5AygS/ePUL8hZqREw12qUums2+HKT1oIlzRBK2GWIvP InUUxOv51ZU0Q7xrvKUJIjw= Received: (qmail 49380 invoked by alias); 8 Jan 2016 18:01:25 -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 49359 invoked by uid 89); 8 Jan 2016 18:01:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=ther, mpx, cloning, sorts 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 (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 08 Jan 2016 18:01:23 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A9F86AC04; Fri, 8 Jan 2016 18:01:19 +0000 (UTC) Date: Fri, 8 Jan 2016 19:01:19 +0100 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PR 69044] Do not clone for parameter removal when !can_change_signature Message-ID: <20160108180119.GJ3060@virgil.suse.cz> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi, we generally do not have ther ability to propagate constants to and clone CHKP instrumented functions. Therefore we do not propagate stuff into their lattices but since Honza changed cloning for all contexts heuristics a few weeks ago, we might attempt to clone them for unused parameter removal, which then leads to an ICE (and all sorts of issues). The heuristics however should not attempt to do that because the function cgraph_node has can_change_signature flag cleared. So this patch changes it accordingly. Bootstrapped and tested on x86_64-linux, OK for trunk? Thanks, Martin 2016-01-08 Martin Jambor PR ipa/69044 * ipa-cp.c (estimate_local_effects): Do not clone for removal of useless parameters if we cannot change function signature. testsuite/ * gcc.target/i386/chkp-pr69044.c: New test. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 782df71..d99e69c 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2518,7 +2518,8 @@ estimate_local_effects (struct cgraph_node *node) known_aggs_ptrs = agg_jmp_p_vec_for_t_vec (known_aggs); int devirt_bonus = devirtualization_time_bonus (node, known_csts, known_contexts, known_aggs_ptrs); - if (always_const || devirt_bonus || removable_params_cost) + if (always_const || devirt_bonus + || (removable_params_cost && node->local.can_change_signature)) { struct caller_statistics stats; inline_hints hints; diff --git a/gcc/testsuite/gcc.target/i386/chkp-pr69044.c b/gcc/testsuite/gcc.target/i386/chkp-pr69044.c new file mode 100644 index 0000000..933e88a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/chkp-pr69044.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mpx } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +int i; +int strncasecmp (char *p1, char *p2, long p3) { return 0; } +int special_command () +{ + if (strncasecmp (0, 0, 0)) + i++; +}