From patchwork Mon Feb 12 17:35:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 872228 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-473093-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OsuGWw2u"; 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 3zgCWN2QHBz9sBZ for ; Tue, 13 Feb 2018 04:35:58 +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:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=v9q9QdvLfNCQV95bHvKW83rm9CdhXXzQ5/f4kNV2ywa0QRnTWd DvgB8BeBux9s99PPzsw+zgfoL2SKIEGUkvvCLhQ+sYix/DAlh/Cu74WQBrK7bX08 K2gucerlxaqhakoYHhtUD6VM36UGH/YCt3oKUmfbhtxaXYeLZtdDerf+c= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=RW78sRp1HoBqlsTu8GBC/vf1JZc=; b=OsuGWw2uor+6Ysr8fb8b 3pyrDJtPDZq/0I1e0gWS/4Njihl1IRsH1VXeAWanQJ6fvl2wh4QjVr9/HU9fANaS eE9GvygHexddjqFn4zteGcHoGP+OZYiWG7o1IWLK8V4+7hsDnDba6MZNgbt6dcGn CsCvW2EZRlt02rNqYM2yOrc= Received: (qmail 83482 invoked by alias); 12 Feb 2018 17:35:51 -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 83473 invoked by uid 89); 12 Feb 2018 17:35:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=H*UA:https 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, 12 Feb 2018 17:35:50 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E3E3EAE70 for ; Mon, 12 Feb 2018 17:35:47 +0000 (UTC) From: Martin Jambor To: GCC Patches Cc: Subject: [PR 83990] Fix location handling in ipa_modify_call_arguments User-Agent: Notmuch/0.25.1 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-suse-linux-gnu) Date: Mon, 12 Feb 2018 18:35:47 +0100 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi, the callee-side arguments manipulation method used by IPA-SRA has two issues with how it deals with locations. First, it gets the location from expressions in an unreliable way rather than the statements it sees and then it forgets to set a location of one gimple assign it creates. Both is fixed in the patch below. I have bootstrapped and tested the patch on an x86_64-linux and consider it pre-approved by Jakub in bugzilla so plan to commit it to trunk tomorrow and to the gcc-7-branch soon afterwards (after testing there). Thanks, Martin 2018-01-30 Martin Jambor PR c++/83990 * ipa-param-manipulation.c (ipa_modify_call_arguments): Use location of call statements, also set location of a load to a temporary. --- gcc/ipa-param-manipulation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c index 36290704644..1ab1fcccdae 100644 --- a/gcc/ipa-param-manipulation.c +++ b/gcc/ipa-param-manipulation.c @@ -295,8 +295,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt, poly_int64 byte_offset = exact_div (adj->offset, BITS_PER_UNIT); base = gimple_call_arg (stmt, adj->base_index); - loc = DECL_P (base) ? DECL_SOURCE_LOCATION (base) - : EXPR_LOCATION (base); + loc = gimple_location (stmt); if (TREE_CODE (base) != ADDR_EXPR && POINTER_TYPE_P (TREE_TYPE (base))) @@ -385,6 +384,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt, else expr = create_tmp_reg (TREE_TYPE (expr)); gimple_assign_set_lhs (tem, expr); + gimple_set_location (tem, loc); gsi_insert_before (&gsi, tem, GSI_SAME_STMT); } }