From patchwork Sat Oct 10 17:42:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1380094 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C7sjV035Fz9sS8 for ; Sun, 11 Oct 2020 04:43:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23C833857832; Sat, 10 Oct 2020 17:43:05 +0000 (GMT) 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 027AA3857801 for ; Sat, 10 Oct 2020 17:43:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 027AA3857801 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7D60E280878; Sat, 10 Oct 2020 19:42:58 +0200 (CEST) Date: Sat, 10 Oct 2020 19:42:58 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, d@dcepelik.cz Subject: Improve tree-ssa-alias dump files Message-ID: <20201010174258.GA35127@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=-13.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, this patch improves debug info of modref so it is easier to track down misoptimizations. Bootstrapped/regtested x86_64-linux, comitted. Honza gcc/ChangeLog: 2020-10-10 Jan Hubicka * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Improve debug dumps. (call_may_clobber_ref_p_1): Improve debug dumps. diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index ac7e020c5e2..877e4999f0f 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "attr-fnspec.h" #include "errors.h" #include "dbgcnt.h" +#include "gimple-pretty-print.h" /* Broad overview of how alias analysis on gimple works: @@ -2610,13 +2611,23 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p) alias_stats.modref_use_no_alias++; if (dump_file && (dump_flags & TDF_DETAILS)) { - fprintf (dump_file, "ipa-modref: in %s," - " call to %s does not use ", - cgraph_node::get - (current_function_decl)->dump_name (), + fprintf (dump_file, + "ipa-modref: call stmt "); + print_gimple_stmt (dump_file, call, 0); + fprintf (dump_file, + "ipa-modref: call to %s does not use ", node->dump_name ()); - print_generic_expr (dump_file, ref->ref); - fprintf (dump_file, " %i->%i\n", + if (!ref->ref && ref->base) + { + fprintf (dump_file, "base: "); + print_generic_expr (dump_file, ref->base); + } + else if (ref->ref) + { + fprintf (dump_file, "ref: "); + print_generic_expr (dump_file, ref->ref); + } + fprintf (dump_file, " alias sets: %i->%i\n", ao_ref_base_alias_set (ref), ao_ref_alias_set (ref)); } @@ -3035,13 +3046,22 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p) if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, - "ipa-modref: in %s, " - "call to %s does not clobber ", - cgraph_node::get - (current_function_decl)->dump_name (), + "ipa-modref: call stmt "); + print_gimple_stmt (dump_file, call, 0); + fprintf (dump_file, + "ipa-modref: call to %s does not clobber ", node->dump_name ()); - print_generic_expr (dump_file, ref->ref); - fprintf (dump_file, " %i->%i\n", + if (!ref->ref && ref->base) + { + fprintf (dump_file, "base: "); + print_generic_expr (dump_file, ref->base); + } + else if (ref->ref) + { + fprintf (dump_file, "ref: "); + print_generic_expr (dump_file, ref->ref); + } + fprintf (dump_file, " alias sets: %i->%i\n", ao_ref_base_alias_set (ref), ao_ref_alias_set (ref)); }