From patchwork Fri May 10 12:39:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1098031 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500432-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bwU5UW50"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="l05CCAJa"; dkim-atps=neutral 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 450qYV0bjpz9s9y for ; Fri, 10 May 2019 22:40:11 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=k0Fw6/ttCuRG3AoKtUndoe8HcLQMKLUSKstEVt2MPHNo6gDFJ8 v20sGSGEJWUbQPUe1Bnzdtkci9Av8GWZZHP7mzsf4soIEkY/xJR+4uJF+c4EbxD/ 0kMERoFPmZWyd4z/wlxYGPhmPrSKyQ6KsGsEEjL6Cf683mPalr3LkrtL0= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=H3z8cTAuDrvk3ONecVTkmQDye5Y=; b=bwU5UW50FfzTStDgOVPA AhTBb+IdFw1GJa7mMkCXGK91exFR/QaQJX0rDoH1PNohpxeMiFZFgbtKJIvbIYQ5 3uTBA50ggbJ43Ck/QvRmWGBa7XnDxFMtLv3D86XG/0M94gGlenqBhBDjNKg6saYv S8UYyq0IWbQQvw5SiEoBXak= Received: (qmail 45762 invoked by alias); 10 May 2019 12:40:04 -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 45750 invoked by uid 89); 10 May 2019 12:40:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:DW_AT_s, sk:dw_at_s, VAR_P, var_p X-HELO: mail-pg1-f169.google.com Received: from mail-pg1-f169.google.com (HELO mail-pg1-f169.google.com) (209.85.215.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 May 2019 12:40:02 +0000 Received: by mail-pg1-f169.google.com with SMTP id d31so2976622pgl.7 for ; Fri, 10 May 2019 05:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=6H6iTIzJjNy5TkJTj3A1TOwjXfgLSdcf8XYifSjad/s=; b=l05CCAJanjGFxIzRF9hd2DsimEFD06rHVxPuCbOXyag0gF0eAywJh7kPw12rB8Xwun ZL4mSG6WZTreW9BWpTf+0w6tIYaHL/DumQD1DQ9pq24ykb+OeKtsiztfkPf0h2ga7y9E mYIhg/bYCSTU5tuyj2ZlJtaFHDjEwHhuSKbj9XgHrIa7zupCk/aFUiMWTAtY/Wdwz3h5 931G4w0H9X8zIx+XeJAcGvAI41pH38CFeASzklCYMwit2MWNbEoSOtAifGtE2cRkmEvN GE+J0uggF1CptWfBIXkE+wzdR2hCJMus6Tw0Fmf0KTzAQ6c160iNf9tSVz1XHohJ+BF0 cySQ== Received: from ?IPv6:2620:10d:c0a3:1407:7dd4:eea5:8955:ad0c? ([2620:10d:c091:500::2:ad91]) by smtp.googlemail.com with ESMTPSA id k65sm8841999pfj.141.2019.05.10.05.39.58 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 05:39:58 -0700 (PDT) To: GCC Patches , Richard Biener From: Nathan Sidwell Subject: [DWARF] dwarf2out cleanups Message-ID: Date: Fri, 10 May 2019 08:39:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 When poking at some dwarf bugs, which were ultimately fixed by Richard, I made a couple of cleanups. The first two are pretty obvious comment clarification, but the last fragment is a more invasive control flow change. In that case we essentially repeat an inline-static-var check in two places. I've replaced that with a bool to control whether we should splice. That at least helped me understand the code better, and should give the optimizer better visibility to simplify the generated control flow. tested on x86_64-linux, ok? nathan 2019-05-10 Nathan Sidwell * dwarf2out.c (breakout_comdat_types): Move comment to correct piece of code. (const_ok_for_output_1): Balance parens around #if/#else/#endif (gen_member_die): Move abstract origin check earlier. Only VARs can be static_inline_p. Simplify splicing control flow. Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 271062) +++ dwarf2out.c (working copy) @@ -8576,11 +8576,12 @@ break_out_comdat_types (dw_die_ref die) /* Break out nested types into their own type units. */ break_out_comdat_types (c); - /* Create a new type unit DIE as the root for the new tree, and - add it to the list of comdat types. */ + /* Create a new type unit DIE as the root for the new tree. */ unit = new_die (DW_TAG_type_unit, NULL, NULL); add_AT_unsigned (unit, DW_AT_language, get_AT_unsigned (comp_unit_die (), DW_AT_language)); + + /* Add the new unit's type DIE into the comdat type list. */ type_node = ggc_cleared_alloc (); type_node->root_die = unit; type_node->next = comdat_type_list; @@ -14509,11 +14510,10 @@ const_ok_for_output_1 (rtx rtl) "non-delegitimized UNSPEC %s (%d) found in variable location", ((XINT (rtl, 1) >= 0 && XINT (rtl, 1) < NUM_UNSPEC_VALUES) ? unspec_strings[XINT (rtl, 1)] : "unknown"), - XINT (rtl, 1)); #else "non-delegitimized UNSPEC %d found in variable location", - XINT (rtl, 1)); #endif + XINT (rtl, 1)); expansion_failed (NULL_TREE, rtl, "UNSPEC hasn't been delegitimized.\n"); return false; @@ -25161,19 +25161,20 @@ gen_member_die (tree type, dw_die_ref co context_die); } - /* Now output info about the data members and type members. */ + /* Now output info about the members. */ for (member = TYPE_FIELDS (type); member; member = DECL_CHAIN (member)) { + /* Ignore clones. */ + if (DECL_ABSTRACT_ORIGIN (member)) + continue; + struct vlr_context vlr_ctx = { type, NULL_TREE }; bool static_inline_p - = (TREE_STATIC (member) + = (VAR_P (member) + && TREE_STATIC (member) && (lang_hooks.decls.decl_dwarf_attribute (member, DW_AT_inline) != -1)); - /* Ignore clones. */ - if (DECL_ABSTRACT_ORIGIN (member)) - continue; - /* If we thought we were generating minimal debug info for TYPE and then changed our minds, some of the member declarations may have already been defined. Don't define them again, but @@ -25183,11 +25184,14 @@ gen_member_die (tree type, dw_die_ref co { /* Handle inline static data members, which only have in-class declarations. */ - dw_die_ref ref = NULL; + bool splice = true; + + dw_die_ref ref = NULL; if (child->die_tag == DW_TAG_variable && child->die_parent == comp_unit_die ()) { ref = get_AT_ref (child, DW_AT_specification); + /* For C++17 inline static data members followed by redundant out of class redeclaration, we might get here with child being the DIE created for the out of class @@ -25206,17 +25210,17 @@ gen_member_die (tree type, dw_die_ref co ref = NULL; static_inline_p = false; } - } - if (child->die_tag == DW_TAG_variable - && child->die_parent == comp_unit_die () - && ref == NULL) - { - reparent_child (child, context_die); - if (dwarf_version < 5) - child->die_tag = DW_TAG_member; + if (!ref) + { + reparent_child (child, context_die); + if (dwarf_version < 5) + child->die_tag = DW_TAG_member; + splice = false; + } } - else + + if (splice) splice_child_die (context_die, child); }