From patchwork Fri May 30 12:56:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 354170 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 6762C1400E0 for ; Fri, 30 May 2014 22:56:56 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=Ne4OuNbRCrAE8DgIP9l8ZjEnFD+PnUAiKVwLg+4/bdgc+Qlb69VN+ LmLUoI0WhhOrzKlTYr2ORvl+XTE7z9QbYc3ld/Dz2vK4C2hbEjdXHVLeYMh0HUKI 7QR/xChNDSssMq0A+9KeXj3vlHLbksE86SGEdJ8sJhJoPY0YLn4ML4= 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:subject:message-id:mime-version:content-type; s= default; bh=vQceuAr28Kuh3ZHCny1XCixBmDk=; b=IHi2UR/a0nlMtMQu3rrJ U3FIhqEbRMUq0JOvSJbbFWp0z8n1+SrszUa30kyMiroiNbp3WiYOW5KQ2/iu/Mmg OEKMP9Wh2HfhVKwDxFRY9clykSIaYy9F3kIBqhuG3fizoVJUTBS1/m5C/GMxyXmt sDPiUZkMYv9AetFflTRGp5o= Received: (qmail 8474 invoked by alias); 30 May 2014 12:56:48 -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 8445 invoked by uid 89); 30 May 2014 12:56:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pb0-f48.google.com Received: from mail-pb0-f48.google.com (HELO mail-pb0-f48.google.com) (209.85.160.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 30 May 2014 12:56:45 +0000 Received: by mail-pb0-f48.google.com with SMTP id rr13so1699784pbb.7 for ; Fri, 30 May 2014 05:56:44 -0700 (PDT) X-Received: by 10.66.231.237 with SMTP id tj13mr18379238pac.136.1401454603828; Fri, 30 May 2014 05:56:43 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.55.41]) by mx.google.com with ESMTPSA id kj1sm6382282pbd.20.2014.05.30.05.56.41 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 May 2014 05:56:43 -0700 (PDT) Date: Fri, 30 May 2014 16:56:31 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, Pointer Bounds Checker 15/x] Keep instrumented versions Message-ID: <20140530125631.GA45878@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, Before any instrumentation happens, instrumentation clones do not actually have any uses and thus may be removed. This patch fixes it by forbiding removal of not instrumented instrumentation clones. Bootstrapped and tested on linux-x86_64. Thanks, Ilya --- gcc/ 2014-05-30 Ilya Enkovich * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Keep all not instrumented instrumentation clones alive. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 6210c68..1f684c2 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2425,6 +2425,12 @@ bool cgraph_can_remove_if_no_direct_calls_and_refs_p (struct cgraph_node *node) { gcc_assert (!node->global.inlined_to); + /* Instrumentation clones should not be removed before + instrumentation happens. New callers may appear after + instrumentation. */ + if (node->instrumentation_clone + && !chkp_function_instrumented_p (node->decl)) + return false; /* Extern inlines can always go, we will use the external definition. */ if (DECL_EXTERNAL (node->decl)) return true;