From patchwork Mon Jan 20 11:04:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1225879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-517746-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=uxk4Xh8q; 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 481TMP5y6Qz9sSK for ; Mon, 20 Jan 2020 22:04:32 +1100 (AEDT) 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=CFZWOO4ELYJvS6jN0HLK5WpcFI4eEhk7TjfRd4/fQ+ENP1NmEy frdHFnJEFkEBVbQ7om9DDC5iZSEEb4XQOa04JeWAwZ2JZawLWg6EsVSeLQMe1BZJ 1cSSTvf2w9CE0c8nOXkwlQsT6vSO56R/UnoqHAvjVDSAgm3mDfCz4JViU= 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=lYBO3v6wX1odcqC5YjhobI9kIYo=; b=uxk4Xh8qyS4nFHyl1FXt mux66Hu9flhNWl33UvhsB+RYbcILlWLtOyAGJfqs7/cCg5smKAjqdJAJBMEsU/PA /KZ/OkyHV1f9nRDEnQ1fpnk7Ha3xcWLdSCVoZXJJ3he9jO7MAHmECfvCwYaMhSCu psJfMMDH+Jwx3NXFz4YdHnI= Received: (qmail 119825 invoked by alias); 20 Jan 2020 11:04:24 -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 119812 invoked by uid 89); 20 Jan 2020 11:04:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 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; Mon, 20 Jan 2020 11:04:14 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 70B3CABB3; Mon, 20 Jan 2020 11:04:12 +0000 (UTC) Date: Mon, 20 Jan 2020 12:04:12 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek Subject: [PATCH] debug/92763 keep DIEs that might be used in DW_TAG_inlined_subroutine Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 We were pruning type-local subroutine DIEs if their context is unused despite us later needing those DIEs as abstract origins for inlines. The patch makes code already present for -fvar-tracking-assignments unconditional. Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? Thanks, Richard. 2020-01-20 Richard Biener PR debug/92763 * dwarf2out.c (prune_unused_types): Unconditionally mark called function DIEs. * g++.dg/debug/pr92763.C: New testcase. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 70b3fad13a2..fe46c7e1eee 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -29529,9 +29529,9 @@ prune_unused_types (void) for (i = 0; base_types.iterate (i, &base_type); i++) prune_unused_types_mark (base_type, 1); - /* For -fvar-tracking-assignments, also set the mark on nodes that could be - referenced by DW_TAG_call_site DW_AT_call_origin (i.e. direct call - callees). */ + /* Also set the mark on nodes that could be referenced by + DW_TAG_call_site DW_AT_call_origin (i.e. direct call callees) or + by DW_TAG_inlined_subroutine origins. */ cgraph_node *cnode; FOR_EACH_FUNCTION (cnode) if (cnode->referred_to_p (false)) @@ -29540,8 +29540,7 @@ prune_unused_types (void) if (die == NULL || die->die_mark) continue; for (cgraph_edge *e = cnode->callers; e; e = e->next_caller) - if (e->caller != cnode - && opt_for_fn (e->caller->decl, flag_var_tracking_assignments)) + if (e->caller != cnode) { prune_unused_types_mark (die, 1); break; diff --git a/gcc/testsuite/g++.dg/debug/pr92763.C b/gcc/testsuite/g++.dg/debug/pr92763.C new file mode 100644 index 00000000000..8e32d60039f --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/pr92763.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-additional-options "-fno-var-tracking-assignments -fopenmp" } + +struct A +{ + typedef int T; + #pragma omp declare reduction (y : T : [&omp_out, &omp_in]() { omp_out += omp_in; return 0; }()) initializer (omp_priv = [omp_orig]() { return omp_orig; }()) + static void foo (); +}; + +void +A::foo () +{ + int r = 0, s = 0; + #pragma omp parallel for reduction (y : r, s) + for (int i = 0; i < 1; i++) + { + } +}