From patchwork Wed Jan 17 19:01:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 84297 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 1BE643858427 for ; Wed, 17 Jan 2024 19:02:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 77BFB3858C52 for ; Wed, 17 Jan 2024 19:01:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77BFB3858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 77BFB3858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705518100; cv=none; b=f2YkDvUd3/70ukZSsXaAYPjF2dMdxE/fHLH2nzLA+0uejLebrwYQ4qWkZEKtiPM1L9Hzrv2wTTlCKLAyDJsVj/Ydo/itotXbnu9WK3iEMRkRMhGRN7kKWrPwPxSM4PDh+bsyn8ek41KWQp6vp/hmQZw0SjoXHenoY524Ly8ohW8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705518100; c=relaxed/simple; bh=CkACz2hVcQQyb6GC200Z+R8EgEfe7BwYEX5Q+ktN6Uk=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=uNFESCE9DKo9hUhyIdbXINya3B5vSnwOTBgtROPQvXySNz2Ke0z8Fz5oCFCWcSC05Wu8lAdOnggcKbr2Tdr9McCChDkR2SMTSR7NdqcGgIe2UxN+lE9qwnCB6ncv2dMJnkXaPG5M6WsoVOPLHJEz2hd0PDPDAOSLnam1kKgE86c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6d9344f30caso7676938b3a.1 for ; Wed, 17 Jan 2024 11:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1705518096; x=1706122896; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/KHGCI3KAcdjI/hhQbuv5BwcNuneGTJ9pJQvlFufXR4=; b=Ox4V05RgZKfZX65LUTSZZK3i9niYGc+vQB4eSpowVouiim46UgpJIlZg/QNSj1Rq/b dv9BfKTHR6Zk1SRu4/pS5OgcQl7ESCvTKsCjAguqdOJ1zEnds+GQ7KQxiTOlpBgADfe1 zOEfFCZM5P7F9CAqw364Rv7Bb4XnvyiRyW2mTJUT52NdKIg45HlzFpt1SPnWuEfJjjor DE47fOMCiUSaiXk2ZlB5RJZ7AuUSL9g2JvnDufq3P16etLPZ4jLSihcBiTAEq943Lui+ ydGcG4pM7/IGHcxsgZRVwl1uJmaj4s7Idk4NKSwEl4nqT+2H9rgx9XwMttFYLUEtEF2Z WFDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705518096; x=1706122896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/KHGCI3KAcdjI/hhQbuv5BwcNuneGTJ9pJQvlFufXR4=; b=IaywHPv1cxlBA+jtNe8jWxXoEvAXapaJeINfEAotKU7Bp5W+v7yQasjeV7B3bchnww b/X53GxENwKndTjV1wfqXij36BThQwYIvmWkmTLxozTtPBzyOveCz/X0gck1xVOyR2zT lgvuc8AdB8FDvs3WeYeBd2RPdkX4/2sP/d0kdw8LpUP67IVoMYmtf/yfcGqAfdv+UZ0R AQzRB3vCp4L/XH6DAGtnEuZfH9Y45hFwH7kWE/Vt7SsRvbx/BQi5DhCfHRLBZDq03FSV lnsHKJ1bPbjTd4ZsDMLWqrGgf9Bp52Dui2pDtrobo2j4BHL+cu8ZgpzQEp+hjOK1qcVJ UX/w== X-Gm-Message-State: AOJu0YzSWuTFXnQdIRTPgR9f7LIg2RaEfhZj/qqame8A7cV9Jv52UCIE 0QzjhMpmt0wXfr8CcekL0jl7v+jW5Pflgz1fqSZwVx26L2Fyx5lyA5TFgUHYy3JP1kNflKMVP+w i X-Google-Smtp-Source: AGHT+IFAP2wYpMk0pvc3y8PDsa4L1lQ+if3MbGNch37aOCD7swav0hamYO9GGbnTRMEG/CYcJ8F6Ng== X-Received: by 2002:a05:6a00:1306:b0:6d9:be60:9b93 with SMTP id j6-20020a056a00130600b006d9be609b93mr1818752pfu.12.1705518096087; Wed, 17 Jan 2024 11:01:36 -0800 (PST) Received: from vineet-framework.ba.rivosinc.com ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id z2-20020aa785c2000000b006d99d986624sm1786542pfn.151.2024.01.17.11.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:01:35 -0800 (PST) From: Vineet Gupta To: gcc-patches@gcc.gnu.org Cc: gnu-toolchain@rivosinc.com, Vineet Gupta Subject: [COMITTED 2/2] RISC-V: fix some vsetvl debug info in pass's Phase 2 code [NFC] Date: Wed, 17 Jan 2024 11:01:32 -0800 Message-Id: <20240117190132.450071-1-vineetg@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <33D9750FAAB8AC40+2024011706320068727626@rivai.ai> References: <33D9750FAAB8AC40+2024011706320068727626@rivai.ai> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+patchwork=sourceware.org@gcc.gnu.org When staring at VSETVL pass for PR/113429, spotted some minor improvements. 1. For readablity, remove some redundant condition check in Phase 2 function earliest_fuse_vsetvl_info (). 2. Add iteration count in debug prints in same function. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (earliest_fuse_vsetvl_info): Remove redundant checks in else condition for readablity. (earliest_fuse_vsetvl_info) Print iteration count in debug prints. (earliest_fuse_vsetvl_info) Fix misleading vsetvl info dump details in certain cases. Signed-off-by: Vineet Gupta --- gcc/config/riscv/riscv-vsetvl.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 78a2f7b38faf..41d4b80648f6 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -2343,7 +2343,7 @@ public: void compute_lcm_local_properties (); void fuse_local_vsetvl_info (); - bool earliest_fuse_vsetvl_info (); + bool earliest_fuse_vsetvl_info (int iter); void pre_global_vsetvl_info (); void emit_vsetvl (); void cleaup (); @@ -2961,7 +2961,7 @@ pre_vsetvl::fuse_local_vsetvl_info () bool -pre_vsetvl::earliest_fuse_vsetvl_info () +pre_vsetvl::earliest_fuse_vsetvl_info (int iter) { compute_avl_def_data (); compute_vsetvl_def_data (); @@ -2984,7 +2984,8 @@ pre_vsetvl::earliest_fuse_vsetvl_info () if (dump_file && (dump_flags & TDF_DETAILS)) { - fprintf (dump_file, "\n Compute LCM earliest insert data:\n\n"); + fprintf (dump_file, "\n Compute LCM earliest insert data (lift %d):\n\n", + iter); fprintf (dump_file, " Expression List (%u):\n", num_exprs); for (unsigned i = 0; i < num_exprs; i++) { @@ -3032,7 +3033,7 @@ pre_vsetvl::earliest_fuse_vsetvl_info () if (dump_file && (dump_flags & TDF_DETAILS)) { - fprintf (dump_file, " Fused global info result:\n"); + fprintf (dump_file, " Fused global info result (lift %d):\n", iter); } bool changed = false; @@ -3142,8 +3143,7 @@ pre_vsetvl::earliest_fuse_vsetvl_info () if (src_block_info.has_info ()) src_block_info.probability += dest_block_info.probability; } - else if (src_block_info.has_info () - && !m_dem.compatible_p (prev_info, curr_info)) + else { /* Cancel lift up if probabilities are equal. */ if (successors_probability_equal_p (eg->src)) @@ -3151,11 +3151,11 @@ pre_vsetvl::earliest_fuse_vsetvl_info () if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, - " Change empty bb %u to from:", + " Reset bb %u:", eg->src->index); prev_info.dump (dump_file, " "); fprintf (dump_file, - " to (higher probability):"); + " due to (same probability):"); curr_info.dump (dump_file, " "); } src_block_info.set_empty_info (); @@ -3170,7 +3170,7 @@ pre_vsetvl::earliest_fuse_vsetvl_info () if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, - " Change empty bb %u to from:", + " Change bb %u from:", eg->src->index); prev_info.dump (dump_file, " "); fprintf (dump_file, @@ -3627,7 +3627,7 @@ pass_vsetvl::lazy_vsetvl () { if (dump_file) fprintf (dump_file, " Try lift up %d.\n\n", fused_count); - changed = pre.earliest_fuse_vsetvl_info (); + changed = pre.earliest_fuse_vsetvl_info (fused_count); fused_count += 1; } while (changed);