From patchwork Tue Aug 3 12:34:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1512895 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+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.a=rsa-sha256 header.s=default header.b=jyRGq1Ci; dkim-atps=neutral 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 4GfDq92lQZz9sS8 for ; Tue, 3 Aug 2021 22:35:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A39F6385DC30 for ; Tue, 3 Aug 2021 12:35:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A39F6385DC30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1627994112; bh=+oqysMOGxVHkEo2F8ghQRv0aueLxEtxEVamANNKVsxQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jyRGq1CiZrDuEsIvmFPVLs9f/p1fGP8SW5CG1Q3Vpoow37V6g5oSoTRk6O9rJBF+V g2P9zTKqjGhZDXWQFe7D4e9PrlM3IYGPeisNSwfEN0tCgJTbQCh5NTFdm1tsuVznHn qXHsfviVlbkjoyr16Gw2kv73tVjQkt7YylIN1oJU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 7801D385DC30 for ; Tue, 3 Aug 2021 12:34:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7801D385DC30 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2EAC711FB for ; Tue, 3 Aug 2021 05:34:50 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CAC693F40C for ; Tue, 3 Aug 2021 05:34:49 -0700 (PDT) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH] vect: Tweak dump messages for vector mode choice Date: Tue, 03 Aug 2021 13:34:48 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, 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: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" After vect_analyze_loop has successfully analysed a loop for one base vector mode B1, it considers using following base vector modes to vectorise an epilogue. However, for VECT_COMPARE_COSTS, a later mode B2 might turn out to be better than B1 was. Initially this comparison will be between an epilogue loop (for B2) and a main loop (for B1). However, in r11-6458 I'd added code to reanalyse the B2 epilogue loop as a main loop, partly for correctness and partly for better costing. This can lead to a situation in which we think that the B2 epilogue loop was better than the B1 main loop, but that the B2 main loop is not better than the B1 main loop. There was no dump message to say that this had happened, which made it look like B2 had still won. Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard gcc/ * tree-vect-loop.c (vect_analyze_loop): Print a dump message when a reanalyzed loop fails to be cheaper than the current main loop. --- gcc/tree-vect-loop.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 00a57b2ba62..48a54b0957f 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -3064,7 +3064,16 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared) = opt_loop_vec_info::success (main_loop_vinfo); } else - delete main_loop_vinfo; + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "***** No longer preferring vector" + " mode %s after reanalyzing the loop" + " as a main loop\n", + GET_MODE_NAME + (main_loop_vinfo->vector_mode)); + delete main_loop_vinfo; + } } }