From patchwork Thu Oct 20 15:20:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 684665 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 3t0CFT5WS8z9ryn for ; Fri, 21 Oct 2016 02:21:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HlAtGBMk; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=GUp/Py6fUncvjzFlPvZduHGxjLPLlSD9Jxhy7pNBwpfhNm1RIs iF7H4CiTF0zjf+U3VDeTep40AHVFpUszIIMohDdJL2xILIQ9qjaCV0BGmfDqn01N yZzg55YENiodftrGy3qh5fAEbpeZyKd0ZR19H/GEzhwZk3YI7PFT264cY= 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:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=2kzilvpfjrChL7qIVg6N/gKn5fM=; b=HlAtGBMk0DrDPEr5VVfh TYYrX6mVJ4EAYl5xjb3SrUQWyuVGQ3BEEElZxIV+LGlGRpzQo7c7yLeu+wfnRGLW Wqlz43fhEE2Nr8Y33JJIKldKPXLH+SRpsy9L1TZ79Q9EZy979VhO7uKjgfYqXcxN sc5hqpdJF9g7gZeaDcSYkc8= Received: (qmail 17043 invoked by alias); 20 Oct 2016 15:21:08 -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 17031 invoked by uid 89); 20 Oct 2016 15:21:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2718, 9187, 9057 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; Thu, 20 Oct 2016 15:20:57 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4BB4EAD49; Thu, 20 Oct 2016 15:20:55 +0000 (UTC) To: GCC Patches Cc: Jan Hubicka From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049) Message-ID: <6c459979-f82b-261d-f286-ec129009bc4a@suse.cz> Date: Thu, 20 Oct 2016 17:20:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes Hello. Following patch fixes issue mentioned in $subject. Problem is connected to thunks that become expanded during WPA phase of LTO. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin From a41a5b1e3b7451c711c520b38f4603c2976a4b02 Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 20 Oct 2016 15:33:31 +0200 Subject: [PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049) gcc/ChangeLog: 2016-10-20 Martin Liska PR lto/78049 * lto-streamer-in.c (fixup_call_stmt_edges_1): Replace value comparison with STMT_UID_NOT_IN_RANGE. (fixup_call_stmt_edges): Do not fixup edges of a thunk in LTRANS. --- gcc/lto-streamer-in.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index f852bf9..1f39e6b 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -889,13 +889,16 @@ static void fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, struct function *fn) { +#define STMT_UID_NOT_IN_RANGE(uid) \ + (gimple_stmt_max_uid (fn) < uid || uid == 0) + struct cgraph_edge *cedge; struct ipa_ref *ref = NULL; unsigned int i; for (cedge = node->callees; cedge; cedge = cedge->next_callee) { - if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid) + if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid)) fatal_error (input_location, "Cgraph edge statement index out of range"); cedge->call_stmt = as_a (stmts[cedge->lto_stmt_uid - 1]); @@ -905,7 +908,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, } for (cedge = node->indirect_calls; cedge; cedge = cedge->next_callee) { - if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid) + if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid)) fatal_error (input_location, "Cgraph edge statement index out of range"); cedge->call_stmt = as_a (stmts[cedge->lto_stmt_uid - 1]); @@ -915,7 +918,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, for (i = 0; node->iterate_reference (i, ref); i++) if (ref->lto_stmt_uid) { - if (gimple_stmt_max_uid (fn) < ref->lto_stmt_uid) + if (STMT_UID_NOT_IN_RANGE (ref->lto_stmt_uid)) fatal_error (input_location, "Reference statement index out of range"); ref->stmt = stmts[ref->lto_stmt_uid - 1]; @@ -937,7 +940,8 @@ fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts) orig = orig->clone_of; fn = DECL_STRUCT_FUNCTION (orig->decl); - fixup_call_stmt_edges_1 (orig, stmts, fn); + if (!orig->thunk.thunk_p) + fixup_call_stmt_edges_1 (orig, stmts, fn); if (orig->clones) for (node = orig->clones; node != orig;) { -- 2.10.1