From patchwork Sat Jun 22 18:54:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1951125 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=SW7cLk1b; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W63Tx0xB0z20X6 for ; Sun, 23 Jun 2024 05:01:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AC4C385DDFE for ; Sat, 22 Jun 2024 19:01:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by sourceware.org (Postfix) with ESMTPS id 9940C385DDC4 for ; Sat, 22 Jun 2024 18:56:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9940C385DDC4 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=linux.intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9940C385DDC4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719082592; cv=none; b=ZLu6u1uwqI5yBx06boU84JcsKDBG+FwIPSLWzsAU+ZbuqmkrIG3J4a4jv10YaO/vCFRSeLNlbBZrvhz3hFWLDzNT6B+8Xtq443tEFUejg0rfMp1ZeJx3xoLx4phEf/sHguC0JJx6PaujTMoy9CybITyhim8m+UeAucrzO9YPNu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719082592; c=relaxed/simple; bh=uAXOksGL/SbBI6rO5m5wXziw0hcd2T3EcN1KTGNCG4g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=r2YZjrH4CVNqcGooQ825/ZB+PHyPv8BtFpnPwPvheFMAwUOcsWk7w/awtwFp1cbXMB17CApysJsMjdijMFnV3mEW7WRRhygyC1r2MncQ4k/0zx/wWt3DU50h89wtuOSFH7kjh1oHUS8Q/06Iufz+D7gNzj0pPtEkhtXG+0isFyQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719082591; x=1750618591; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uAXOksGL/SbBI6rO5m5wXziw0hcd2T3EcN1KTGNCG4g=; b=SW7cLk1b6Xo028Hs3yn5e5VrBjD9ww93ZX80ci7h+/+u2hDpNRsdW/t8 +CUfA5wsC5x3Sb68WlpQfqJrw0Tk3UB4FWMgODNYICo2iXiqT0R0dYuu3 a9N5gDrBEYcZ5H6IdURtHdFl+wceQf1uHO7ZWlknkv02uj9C41EuPoo9o y9qObGS+wZoGUOcUgXvdD9ik9Q2896ZZdIWYUGWTNrajIlFiUYZz5Ekh1 Kji7VJ+o2wLnDzMhUIOcARKUHYtl0N+X6s9BG3LatKZaCZoVHnOLTduqS 4SHz0GHkLcKsLoNM0CtLD8jLKP3lviJ7MbLhGylsJbyHaaVlht228GBCM Q==; X-CSE-ConnectionGUID: mHw9dXMXSYqanHt8rgalqA== X-CSE-MsgGUID: 3SZUu0DATie2gbUhtM6lQQ== X-IronPort-AV: E=McAfee;i="6700,10204,11111"; a="16216447" X-IronPort-AV: E=Sophos;i="6.08,258,1712646000"; d="scan'208";a="16216447" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2024 11:56:06 -0700 X-CSE-ConnectionGUID: brJwgPqXS5mhFGe4ioRRuw== X-CSE-MsgGUID: FTdtH378RJmtyP5VaxpUxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,258,1712646000"; d="scan'208";a="42968342" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2024 11:56:05 -0700 From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH v8 11/12] Dump reason for missing tail call into dump file Date: Sat, 22 Jun 2024 11:54:43 -0700 Message-ID: <20240622185557.1589179-12-ak@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240622185557.1589179-1-ak@linux.intel.com> References: <20240622185557.1589179-1-ak@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org gcc/ChangeLog: * tree-tailcall.cc (maybe_error_musttail): Print reason to dump_file. (find_tail_calls): Print gimple stmt or other reasons that stop the search for tail calls into dump file. --- gcc/tree-tailcall.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/tree-tailcall.cc b/gcc/tree-tailcall.cc index a77fa1511415..f69a9ad40bda 100644 --- a/gcc/tree-tailcall.cc +++ b/gcc/tree-tailcall.cc @@ -442,6 +442,11 @@ maybe_error_musttail (gcall *call, const char *err) gimple_call_set_must_tail (call, false); /* Avoid another error. */ gimple_call_set_tail (call, false); } + if (dump_file) + { + print_gimple_stmt (dump_file, call, 0, TDF_SLIM); + fprintf (dump_file, "Cannot convert: %s\n", err); + } } /* Count succ edges for BB and return in NUM_OTHER and NUM_EH. */ @@ -492,7 +497,12 @@ find_tail_calls (basic_block bb, struct tailcall **ret, bool only_musttail, /* Allow EH edges so that we can give a better error message later. */ if (num_other != 1) - return; + { + if (dump_file) + fprintf (dump_file, "Basic block %d has %d eh / %d other edges\n", + bb->index, num_eh, num_other); + return; + } } bool bad_stmt = false; @@ -537,6 +547,11 @@ find_tail_calls (basic_block bb, struct tailcall **ret, bool only_musttail, if (gimple_references_memory_p (stmt) || gimple_has_volatile_ops (stmt)) { + if (dump_file) + { + fprintf (dump_file, "Cannot handle "); + print_gimple_stmt (dump_file, stmt, 0); + } bad_stmt = true; } }