From patchwork Tue Aug 27 13:14:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 1153825 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-507779-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="rAvT9+Zp"; 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 46Hq9S1Rnrz9sBF for ; Tue, 27 Aug 2019 23:15:06 +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:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=GFR7Tp67zve1mTqR2AObtBERko+mmGcqmrJWaB86I+gHhYP65u vI+pAUOJ0DonjQcU+UGK/8IPnr1Z8k4/bng+xUU121E5dAEkK8dW+bBbci4uDmPq 5molkQKD+yQE5bRQ1UyBTp5RD7B6blzAuTobMjGgCLNhajTJmYY1aQcSA= 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=l7RsNlgd7u3V5dsssUpASdOJZz0=; b=rAvT9+ZprwcvLIZ10Vd2 VB2YQ7ddoczxnwXEhh97TX9RXVht0Eh+VzYeZWiJWgfTa01ejv3SC8BG+n0A97zw 9FOjDIeT5xuH8OPDBG0IIV34RSG4sqGJwqYMsfPvqHXK8Lk+dEQlrsUuJHokn1uH +X3dI7K4qmXMNKrkZq6PNqE= Received: (qmail 1554 invoked by alias); 27 Aug 2019 13:14:57 -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 1534 invoked by uid 89); 27 Aug 2019 13:14:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.2 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=mechanical, mjambor@suse.cz, Small, mjamborsusecz X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Aug 2019 13:14:55 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 920EBAB9B; Tue, 27 Aug 2019 13:14:53 +0000 (UTC) From: Martin Jambor To: GCC Patches Cc: Jan Hubicka , Jan Hubicka Subject: [PR 91468] Small fixes in ipa-cp.c and ipa-prop.c User-Agent: Notmuch/0.29.1 (https://notmuchmail.org) Emacs/26.2 (x86_64-suse-linux-gnu) Date: Tue, 27 Aug 2019 15:14:53 +0200 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi, Feng Xue read through much of ipa-cp.c and ipa-prop.c and reported a few redundancies and small errors in PR 91468. The patch below fixes all of them, specifically: 1) A typo in ipcp_modif_dom_walker::before_dom_children where a wrong tree variable was checked if it is not a VIEW_CONVERT_EXPR. 2) update_jump_functions_after_inlining currently handles combinations of unary arithmetic functions and ancestor jump functions which make no sense, cannot happen in meaningful code, and the code path could conceivably be triggered only if LTO was abused to avoid type-casting. In any case the handling should not be there and does not do anything useful (see discussion in bugzilla for more) and so the patch removes it. 3) compute_complex_assign_jump_func tests a few things twice, because of a rather mechanical cleanup of mine, so these are removed. 4) merge_agg_lats_step contains a redundant condition too, but this one is an important correctness invariant, so I strengthened the already existing checking assert afterwards to be a normal assert. Passed bootstrap and testing on x86_64-linux. OK for trunk? Thanks, Martin 2019-08-26 Martin Jambor PR ipa/91468 * ipa-cp.c (merge_agg_lats_step): Removed redundant test, made a checking assert a normal assert to test it really is redundant. * ipa-prop.c (compute_complex_assign_jump_func): Removed redundant test. (update_jump_functions_after_inlining): Removed combining unary arithmetic operations with an ancestor jump function. (ipcp_modif_dom_walker::before_dom_children): Fix wrong use of rhs instead of t. --- gcc/ipa-cp.c | 8 +++----- gcc/ipa-prop.c | 12 ++---------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 0046064fea1..33d52fe5537 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2026,15 +2026,13 @@ merge_agg_lats_step (class ipcp_param_lattices *dest_plats, if (**aglat && (**aglat)->offset == offset) { - if ((**aglat)->size != val_size - || ((**aglat)->next - && (**aglat)->next->offset < offset + val_size)) + if ((**aglat)->size != val_size) { set_agg_lats_to_bottom (dest_plats); return false; } - gcc_checking_assert (!(**aglat)->next - || (**aglat)->next->offset >= offset + val_size); + gcc_assert (!(**aglat)->next + || (**aglat)->next->offset >= offset + val_size); return true; } else diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 1a0e12e6c0c..a23aa2590a0 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1243,9 +1243,7 @@ compute_complex_assign_jump_func (struct ipa_func_body_info *fbi, break; } case GIMPLE_UNARY_RHS: - if (is_gimple_assign (stmt) - && gimple_assign_rhs_class (stmt) == GIMPLE_UNARY_RHS - && ! CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))) + if (!CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))) ipa_set_jf_unary_pass_through (jfunc, index, gimple_assign_rhs_code (stmt)); default:; @@ -2725,12 +2723,6 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs, dst->value.ancestor.agg_preserved &= src->value.pass_through.agg_preserved; } - else if (src->type == IPA_JF_PASS_THROUGH - && TREE_CODE_CLASS (src->value.pass_through.operation) == tcc_unary) - { - dst->value.ancestor.formal_id = src->value.pass_through.formal_id; - dst->value.ancestor.agg_preserved = false; - } else if (src->type == IPA_JF_ANCESTOR) { dst->value.ancestor.formal_id = src->value.ancestor.formal_id; @@ -4933,7 +4925,7 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb) { /* V_C_E can do things like convert an array of integers to one bigger integer and similar things we do not handle below. */ - if (TREE_CODE (rhs) == VIEW_CONVERT_EXPR) + if (TREE_CODE (t) == VIEW_CONVERT_EXPR) { vce = true; break;