From patchwork Thu May 2 23:38:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 241118 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 940AA2C00CA for ; Fri, 3 May 2013 09:38:49 +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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=ox653A1qc97JJT9nKm nXeZEB7Ugf4gb3SfVyjgTkl4gw7IrzDNz0/s9tKBn9lqtNP3E70zBGNBEZt8+tr1 70ekvW4qOTO7iyIVN5d+q/hKmU89uJanP56rFu1giCGAQqdhV/aPY9Jt5C4O1RTV +YTlkPjKHFQ9Tl8C3oJPNk1DM= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=KN6afD2RkA+59blGVia+574x 16c=; b=t0B2JVIwkiWe4C84ZOMMVjxBymYiwJbrov5iQQIyMyh0luo6fktmiW77 v2oqyevCJd6PHlQ988oQmox86wPcY9kgGG1UUOPCdPYa8W2eYp0OJgbqQJBm230J 2tQiPeDXuOLYokGexWiVwxK/SLFMzHsocS8ETb9MsvcAbMWXYBE= Received: (qmail 16101 invoked by alias); 2 May 2013 23:38:43 -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 16088 invoked by uid 89); 2 May 2013 23:38:42 -0000 X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ee0-f48.google.com (HELO mail-ee0-f48.google.com) (74.125.83.48) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 02 May 2013 23:38:41 +0000 Received: by mail-ee0-f48.google.com with SMTP id d4so534578eek.35 for ; Thu, 02 May 2013 16:38:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=ensYm5B+cehKCaU9jRcLnCrTa/SORfp/fDNk+bEmDpo=; b=XxVH72QzTKuyX/bGmI4NhEqRnnSEOKbDWqIlh9EiHWq8kiVFSTvLVurPxogmg6NyTr gFI5+S1kDYqtConrp8iMNAbBu4MptpHWzNOkZ7WnL3PfEGcQoMPWHRaF6l6C2ZIjAdX8 anKjeeT7RQRwGqEK7EH+pH6liNSpOlWi38UHI9AMpRRSsoZTVa19SYJVRbU+VLVYiAcM oxbCjLEIxo7v4KcfkVf/57qY1TzFH+peevMym7sZKAm61/8SCv2g9+kNt/JOG8dTl8p8 SLQC04fxoIrAut8qAy+GiQQ7UeQe2hVyosFDnxsZec9f0mZAOT+62RCNc4pj8pFiutxn Acew== MIME-Version: 1.0 X-Received: by 10.14.205.194 with SMTP id j42mr1565860eeo.41.1367537919430; Thu, 02 May 2013 16:38:39 -0700 (PDT) Received: by 10.14.69.198 with HTTP; Thu, 2 May 2013 16:38:39 -0700 (PDT) In-Reply-To: References: Date: Thu, 2 May 2013 16:38:39 -0700 Message-ID: Subject: Re: [GOOGLE] Change function naming to use context function assembler name to replace function id From: Dehao Chen To: Xinliang David Li Cc: GCC Patches X-Gm-Message-State: ALoCoQkc6+m9n2kXhkoaFf9u6/EUA7fUBaDubR8DLDWalwtBm0AsbmD0p6KxfE36K1wH63xlIBNx1J0cdBZnWHHVs5yskFPGWH8Z7tadCA0LktcelJNs3vG2jnhSV52avPRyuzXVRP02VF8bAjYg/CIl7/uELza/gyuocXzbfLshZIicETk1IV2F/tcFiKY5nxShvX/XZvTw The root problem is that -fsigned-char and -funsigned-char is incompatible. The fix of the problem: Ok for google branches? Thanks, Dehao On Wed, May 1, 2013 at 10:26 AM, Dehao Chen wrote: > I've seen a case when func_id in aux module is not the same (off by > 1). This is when -fexception is specified. I had not looked into why > though. I'll find out why it is off-by-1 > > Dehao > > On Wed, May 1, 2013 at 9:57 AM, Xinliang David Li wrote: >> On Tue, Apr 30, 2013 at 4:10 PM, Dehao Chen wrote: >>> This patch changes to use context function name to replace function >>> id, which is not available in AutoFDO builds. >> >> Why isn't func_id not available in autofdo builds? The func-id for the >> the same function should remain the same regardless whether the module >> is compiled as an aux module or the primary module. >> >> David >> >>> >>> Bootstrapped and passed regression tests. >>> >>> OK for google branches? >>> >>> Thanks, >>> Dehao >>> >>> Index: gcc/l-ipo.c >>> =================================================================== >>> --- gcc/l-ipo.c (revision 198469) >>> +++ gcc/l-ipo.c (working copy) >>> @@ -1714,9 +1714,10 @@ create_unique_name (tree decl, unsigned module_id) >>> { >>> tree id, assemb_id; >>> char *assembler_name; >>> + const char *context = NULL; >>> const char *name; >>> - struct function *context = NULL; >>> int seq = 0; >>> + int len; >>> >>> if (TREE_CODE (decl) == FUNCTION_DECL) >>> { >>> @@ -1740,7 +1741,8 @@ create_unique_name (tree decl, unsigned module_id) >>> else if (TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL) >>> { >>> id = DECL_NAME (decl); >>> - context = DECL_STRUCT_FUNCTION (DECL_CONTEXT (decl)); >>> + context = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME ( >>> + DECL_CONTEXT (decl))); >>> } >>> else >>> /* file scope context */ >>> @@ -1748,17 +1750,12 @@ create_unique_name (tree decl, unsigned module_id) >>> } >>> >>> name = IDENTIFIER_POINTER (id); >>> + len = strlen (name) + context ? strlen (context) : 0; >>> + assembler_name = (char*) alloca (len + 30); >>> if (context) >>> - { >>> - char *n; >>> - unsigned fno = FUNC_DECL_FUNC_ID (context); >>> - n = (char *)alloca (strlen (name) + 15); >>> - sprintf (n, "%s.%u", name, fno); >>> - name = n; >>> - } >>> - >>> - assembler_name = (char*) alloca (strlen (name) + 30); >>> - sprintf (assembler_name, "%s.cmo.%u", name, module_id); >>> + sprintf (assembler_name, "%s.%s.cmo.%u", context, name, module_id); >>> + else >>> + sprintf (assembler_name, "%s.cmo.%u", name, module_id); >>> seq = get_name_seq_num (assembler_name); >>> if (seq) >>> sprintf (assembler_name, "%s.%d", assembler_name, seq); Index: coverage.c =================================================================== --- coverage.c (revision 198362) +++ coverage.c (working copy) @@ -336,6 +336,7 @@ { "-fsized-delete", "-fno-sized-delete", false }, { "-frtti", "-fno-rtti", true }, { "-fstrict-aliasing", "-fno-strict-aliasing", true }, + { "-fsigned-char", "-funsigned-char", true}, { NULL, NULL, false } };