From patchwork Thu Dec 5 10:08:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1204556 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-515205-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Z1Gzul1a"; 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 47TBJN4LCLz9sPL for ; Thu, 5 Dec 2019 21:08:51 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=IkQDLSxdgdLZYPwpsnZ1AVADF3j8iY/gya3vtgzuUoCyj7G4DI8o0 bRzOFDY3SU3X/U+WL3XNM0LiELmOUxRkyL7HckwEataKhL+G5kO0EyxifIPNkuGX sMYQLpJoNNzh83usHPP/y33sAR1g2QckVOB1iI4LnPjazBWsf6+EW0= 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=P3VFN3eZXGcRWNwXzvkx3vemyso=; b=Z1Gzul1a7M4Q8TZkQhdv azEUy4fbnKEpOHiZYpLX5XRFcIzAwiNlLHPRA+ERh6TLiNvbyjGBDXkrWtrhKfZL hXMwUrj7uqug50KD+V6PdL/Bp8VG0r8hZ09B3/1o9twaC5BicCURxbPUnqJef7lP ohFBpCIiFs15yVbslJcISIM= Received: (qmail 57276 invoked by alias); 5 Dec 2019 10:08:44 -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 57261 invoked by uid 89); 5 Dec 2019 10:08:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Dec 2019 10:08:41 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 87810280D63; Thu, 5 Dec 2019 11:08:39 +0100 (CET) Date: Thu, 5 Dec 2019 11:08:39 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix g++.dg/torture/pr59226.C Message-ID: <20191205100839.bwthdxwsqobd2kan@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch fixes ICE in g++.dg/torture/pr59226.C which was triggered by new comdat_local sanity check. What happens here is that function gets inlined into its own thunk which makes it !comdat_local_p but the updating code does not notice since thunk calls comdat local alias of the function itself and we look at alias target rather than original callee. This also shows that we miss optimization here. Currently we will not inline thunk out of its comdat local group w/o inlining function it is associated with into it. We should teach inline_call to reoslve edges to aliases while inlining and relax calls_comdat_local flag. But this needs bit more work, so I fix the ICE first. Bootstrap running on x86_64-linux, will commit it after testing finishes. * ipa-inline-transform.c (inline_call): Fix maintenatnce of comdat_local Index: ipa-inline-transform.c =================================================================== --- ipa-inline-transform.c (revision 278959) +++ ipa-inline-transform.c (working copy) @@ -331,6 +331,7 @@ inline_call (struct cgraph_edge *e, bool int old_size = 0, new_size = 0; struct cgraph_node *to = NULL; struct cgraph_edge *curr = e; + bool comdat_local = e->callee->comdat_local_p (); struct cgraph_node *callee = e->callee->ultimate_alias_target (); bool new_edges_found = false; @@ -502,7 +503,7 @@ inline_call (struct cgraph_edge *e, bool if (callee->calls_comdat_local) to->calls_comdat_local = true; - else if (to->calls_comdat_local && callee->comdat_local_p ()) + else if (to->calls_comdat_local && comdat_local) { struct cgraph_edge *se = to->callees; for (; se; se = se->next_callee)