From patchwork Sun Dec 19 21:41:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 49103 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E1A9E385840F for ; Sun, 19 Dec 2021 21:41:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E1A9E385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639950110; bh=8C7LTFErZ+aSPtj1wQiTMYLf1581s9tKyk3rnRDFckY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PogwnGJVlfmWzsOJlUSc8pM5eWBdqO2/2EZHX97YSa5v/76wvHOoOwywBut1k3n3d zkacUfXtd1K1vewRM6nYRTNfxW93iUeN/uLMVWDWPJmh1Y5AT9/iPsUtr/BbMUEBcR N2P6xf5IcjEx+OOxDlq49qrv2DGAB29B0i0tHKxo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id F084F3858C60 for ; Sun, 19 Dec 2021 21:41:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F084F3858C60 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 087C0280865; Sun, 19 Dec 2021 22:41:21 +0100 (CET) Date: Sun, 19 Dec 2021 22:41:21 +0100 To: gcc-patches@gcc.gnu.org Subject: Fix early exit in modref_merge_call_site_flags Message-ID: <20211219214121.GC8183@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Hubicka via Gcc-patches From: Jan Hubicka Reply-To: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, when adding support for static chain and return slot flags I forgot to update early exit condition in modref_merge_call_site_flags. This yields to wrong code as demonstrated by the Fortran testcase attached to PR (which I hope someone will help me to turn into testuite one). Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: 2021-12-19 Jan Hubicka PR ipa/103766 * ipa-modref.c (modref_merge_call_site_flags): Fix early exit condition diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index d3590f0b62b..9c411a6297a 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -5019,9 +5019,15 @@ modref_merge_call_site_flags (escape_summary *sum, bool changed = false; bool ignore_stores = ignore_stores_p (caller, callee_ecf_flags); - /* If we have no useful info to propagate. */ - if ((!cur_summary || !cur_summary->arg_flags.length ()) - && (!cur_summary_lto || !cur_summary_lto->arg_flags.length ())) + /* Return early if we have no useful info to propagate. */ + if ((!cur_summary + || (!cur_summary->arg_flags.length () + && !cur_summary->static_chain_flags + && !cur_summary->retslot_flags)) + && (!cur_summary_lto + || (!cur_summary_lto->arg_flags.length () + && !cur_summary_lto->static_chain_flags + && !cur_summary_lto->retslot_flags))) return false; FOR_EACH_VEC_ELT (sum->esc, i, ee)