From patchwork Mon Aug 7 13:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 131960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1441242vqr; Mon, 7 Aug 2023 06:16:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCrgfATPdeqzteC2ubUbbHvgwwc6FEwlSGHIV4PDLY9oeTWnILIKaY1nK+UdiLBHW0fKL/ X-Received: by 2002:a2e:878d:0:b0:2b6:e2c2:d234 with SMTP id n13-20020a2e878d000000b002b6e2c2d234mr6375657lji.33.1691414205422; Mon, 07 Aug 2023 06:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691414205; cv=none; d=google.com; s=arc-20160816; b=d56m31L01iprikMX/JR8oIqSTcEjo2HjjsgSGYP2o80zteRbIRrLZVWQcjso3MPOuL B+PnLdIIS6mY7F+QjNx2/y9LhhTEbz4Rzhl78AK6hrVGVGfhguZndXJzCl1EXtUr4MDQ /4i4iTXBDWTxSShkSCSVQUUi6tqjGhv8JyFsyNT+ebwH+CRXguarv5BcDftbsYn18qBO ee2/LxmHoifO20g4klKQF6lLhfIMBSzE5k5wBXx09rZz2OTC/O4VzVuhjQmF9nqmpa8f REdS7/3gvPc7Oi9WfiHGYVglVmlgWHR2ghZcKmQiByi3q1ZF+sfVV8MB2HG6QBI/p9lJ kRIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=XyYWFuZ4kKUqFBLSS9dVDKh/92xU/R8GA9l2VbxdOac=; fh=etb9MYHN7HLF/sff76ICVdPeKiI8ZsjoOL2bcdG0aog=; b=OGbVfRVWpuGr/qujO3ONyWc3+uYCUR/bog5IR7SPaz4LC2vNDQURqu23MLCi5BAPds RSEOYcUObN267/ys9Tj2plB9iJt9Hp3lutbvXuf6ZNgSIKzH2Zdl5Dw1NqL5nTlDZ7ys 3wlR3wKeFStYok2R9TvTAyzmahTgyMiDgnqgLbmjBqgPp258fKb2W9IOsl9ym1QjWiy4 0pvmQo0r9S+IC6LLoIS4v1NYSaCoB3ny4K4pPdlQAy5pmZPj9GK8y+sKjZx5vlfwPEsw ASpmWK+e3T/c2o396K4tL9Ed2c6berCtfDNABzL2UFGnJcLMyu5mOg2Pyl3iKrrt44NF zI6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="x/e3Ig2u"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x1-20020a170906134100b00991ddce682esi2140750ejb.305.2023.08.07.06.16.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 06:16:45 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="x/e3Ig2u"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CE5733857C41 for ; Mon, 7 Aug 2023 13:16:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE5733857C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691414195; bh=XyYWFuZ4kKUqFBLSS9dVDKh/92xU/R8GA9l2VbxdOac=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=x/e3Ig2uWIFuDX/hvMjTPh5BjiGSLfWSec3AMdUmrbxO8RWSVs/IMsxJwZwaNbjqT GGSIYqb48dWKC/rtTC6zTm5gdoeJn6VxlVObJa3PGj5KYbYDqThP1kCpQuNlSZ5Bx+ qJ06FIRBUBq1dSjZct6yITD/qzvec7Ci6QxvDG24= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 17EBD3858291 for ; Mon, 7 Aug 2023 13:15:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17EBD3858291 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2AE6B21A1C for ; Mon, 7 Aug 2023 13:15:52 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 225392C142 for ; Mon, 7 Aug 2023 13:15:52 +0000 (UTC) Date: Mon, 7 Aug 2023 13:15:52 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Improve -fopt-info-vec for basic-block vectorization User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20230807131635.CE5733857C41@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773576341550694509 X-GMAIL-MSGID: 1773576341550694509 We currently dump notes like flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors .. repeating the same location for multiple instances because we clobber vect_location during BB vectorization. The following avoids this, improving things to flow_lam.f:15:72: optimized: basic block part vectorized using 32 byte vectors flow_lam.f:16:72: optimized: basic block part vectorized using 32 byte vectors flow_lam.f:17:72: optimized: basic block part vectorized using 32 byte vectors flow_lam.f:18:72: optimized: basic block part vectorized using 32 byte vectors ... Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-vect-slp.cc (vect_slp_region): Save/restore vect_location around dumping code. --- gcc/tree-vect-slp.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index a1b153035e1..eab3dcd40ec 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -7496,6 +7496,7 @@ vect_slp_region (vec bbs, vec datarefs, if (instance->subgraph_entries.is_empty ()) continue; + dump_user_location_t saved_vect_location = vect_location; vect_location = instance->location (); if (!unlimited_cost_model (NULL) && !vect_bb_vectorization_profitable_p @@ -7505,9 +7506,11 @@ vect_slp_region (vec bbs, vec datarefs, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "not vectorized: vectorization is not " "profitable.\n"); + vect_location = saved_vect_location; continue; } + vect_location = saved_vect_location; if (!dbg_cnt (vect_slp)) continue; @@ -7557,6 +7560,9 @@ vect_slp_region (vec bbs, vec datarefs, "using SLP\n"); vectorized = true; + dump_user_location_t saved_vect_location = vect_location; + vect_location = instance->location (); + vect_schedule_slp (bb_vinfo, instance->subgraph_entries); unsigned HOST_WIDE_INT bytes; @@ -7572,6 +7578,8 @@ vect_slp_region (vec bbs, vec datarefs, "basic block part vectorized using " "variable length vectors\n"); } + + vect_location = saved_vect_location; } } else