From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by sourceware.org (Postfix) with ESMTPS id 914CD39502D8 for ; Thu, 26 Jan 2023 19:16:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 914CD39502D8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-x931.google.com with SMTP id a40so562934uad.12 for ; Thu, 26 Jan 2023 11:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JxsBbbocQjcFVS9T2AhcmkX5m0rzK31qqSEAp8VR+yM=; b=cdu4XTyJcUTZ0IUJ3cWpOCXdCjG2b+vZMbMB3KmCAw80Mo+CdvxGyXS6EcyQs5GrmE sxbI8DX7kO1AiqyIjNGXnzXitOLuwe3QmChZKcTVBtWx5WUkwA0suAbZes9I6Gegmvki pAg7BnBrpzLBUsFyAmHhaiETQyOtmuWBw/cu+kzmSPQQ3V10qWTm1SOy6d5bjCDZRVc1 V3ecRY5VLwq9bSwOvjTRgHW9ov81z3wZPMGgg4IEacF3Ckiv8W6QcG6nFKmXvdm0oR8B hsapRqCNi+3Whp4t34G02O1fitVmKpLUSW7OJDJU6tkWvBKucCwVbmFKn28BIslo5AXt EOgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JxsBbbocQjcFVS9T2AhcmkX5m0rzK31qqSEAp8VR+yM=; b=VHhNpMQLpXLkV7zlB59TcohncUQs1ZmYls/WWW5R5Rw1GFkMvVNzjgOn9KLFiYcLGx 90mvMKp+9e/Ug4ucV1yqOgYCR3+E5hWzy9humVtcjiAz+E7GpOdhrNk5+gwtUwG/tOOn ee8tcFsEWNj4pKuwHxcXfGrooICqcN/qa4E86fNucThgwWJxkbIdWpfUaKBjMp2dnRMI J+/50lXX2FHt3pa3HautLTRC9BZR9oQWZzIL/0G8+/Aw9Or18+DfF8fMlvmdJKf1jxVq vPmJkmIpZKpELmc0gBb8gjDXshJJIh6Sf5wMnJsK7kYLnNbWheNXEyNP8Bd7B4SFjZQw SbYQ== X-Gm-Message-State: AO0yUKXZIFkE9EF2yT+niBfc+N2Ej+k3HWpAyaSE8Q4g3mJBQh9h9y1N rJ0dFgQh9zYKO4YLEgguZ3NWMJGl/pSi6XnDoWM= X-Google-Smtp-Source: AK7set8SuhvLAzEW/i87ahTuNnuigYZJuPIA3RzZFpZhjfiwwK3NpXTILTqGQ9u8rTnrTJIYXydlJC+rgbvnhgBo0WY= X-Received: by 2002:a9f:204b:0:b0:652:d333:f305 with SMTP id 69-20020a9f204b000000b00652d333f305mr1633493uam.11.1674760609768; Thu, 26 Jan 2023 11:16:49 -0800 (PST) MIME-Version: 1.0 References: <20230109231059.154229-1-juzhe.zhong@rivai.ai> In-Reply-To: <20230109231059.154229-1-juzhe.zhong@rivai.ai> From: Kito Cheng Date: Fri, 27 Jan 2023 03:16:37 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Remove dirty_pat since it is redundant To: juzhe.zhong@rivai.ai Cc: gcc-patches@gcc.gnu.org, palmer@dabbelt.com Content-Type: multipart/alternative; boundary="0000000000003aada005f32f9732" X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,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 List-Id: --0000000000003aada005f32f9732 Content-Type: text/plain; charset="UTF-8" committed, thanks. On Tue, Jan 10, 2023 at 7:11 AM wrote: > From: Ju-Zhe Zhong > > gcc/ChangeLog: > > * config/riscv/riscv-vsetvl.cc (vector_insn_info::operator==): > Remove dirty_pat. > (vector_insn_info::merge): Ditto. > (vector_insn_info::dump): Ditto. > (pass_vsetvl::merge_successors): Ditto. > (pass_vsetvl::backward_demand_fusion): Ditto. > (pass_vsetvl::forward_demand_fusion): Ditto. > (pass_vsetvl::commit_vsetvls): Ditto. > * config/riscv/riscv-vsetvl.h: Ditto. > > --- > gcc/config/riscv/riscv-vsetvl.cc | 28 ++++++++++++---------------- > gcc/config/riscv/riscv-vsetvl.h | 11 +---------- > 2 files changed, 13 insertions(+), 26 deletions(-) > > diff --git a/gcc/config/riscv/riscv-vsetvl.cc > b/gcc/config/riscv/riscv-vsetvl.cc > index 3c920779992..0f12d4ddb23 100644 > --- a/gcc/config/riscv/riscv-vsetvl.cc > +++ b/gcc/config/riscv/riscv-vsetvl.cc > @@ -1083,10 +1083,10 @@ vector_insn_info::operator== (const > vector_insn_info &other) const > if (m_demands[i] != other.demand_p ((enum demand_type) i)) > return false; > > - if (m_insn != other.get_insn ()) > - return false; > - if (m_dirty_pat != other.get_dirty_pat ()) > - return false; > + if (vector_config_insn_p (m_insn->rtl ()) > + || vector_config_insn_p (other.get_insn ()->rtl ())) > + if (m_insn != other.get_insn ()) > + return false; > > if (!same_avl_p (other)) > return false; > @@ -1317,8 +1317,6 @@ vector_insn_info::merge (const vector_insn_info > &merge_info, > new_info.set_insn (merge_info.get_insn ()); > } > > - new_info.set_dirty_pat (merge_info.get_dirty_pat ()); > - > if (!demand_p (DEMAND_AVL) && !merge_info.demand_p (DEMAND_AVL)) > new_info.undemand (DEMAND_AVL); > if (!demand_p (DEMAND_SEW) && !merge_info.demand_p (DEMAND_SEW)) > @@ -1431,11 +1429,6 @@ vector_insn_info::dump (FILE *file) const > fprintf (file, "The real INSN="); > print_rtl_single (file, get_insn ()->rtl ()); > } > - if (get_dirty_pat ()) > - { > - fprintf (file, "Dirty RTL Pattern="); > - print_rtl_single (file, get_dirty_pat ()); > - } > } > } > > @@ -1967,7 +1960,6 @@ pass_vsetvl::merge_successors (const basic_block > father, > > new_info.set_dirty (); > rtx new_pat = gen_vsetvl_pat (new_info.get_insn ()->rtl (), > new_info); > - new_info.set_dirty_pat (new_pat); > > father_info.local_dem = new_info; > father_info.reaching_out = new_info; > @@ -2051,7 +2043,6 @@ pass_vsetvl::backward_demand_fusion (void) > > block_info.reaching_out = prop; > block_info.reaching_out.set_dirty (); > - block_info.reaching_out.set_dirty_pat (new_pat); > block_info.local_dem = block_info.reaching_out; > changed_p = true; > } > @@ -2080,7 +2071,6 @@ pass_vsetvl::backward_demand_fusion (void) > rtx new_pat > = gen_vsetvl_pat (new_info.get_insn ()->rtl (), new_info); > new_info.set_dirty (); > - new_info.set_dirty_pat (new_pat); > block_info.local_dem = new_info; > block_info.reaching_out = new_info; > changed_p = true; > @@ -2178,7 +2168,6 @@ pass_vsetvl::forward_demand_fusion (void) > = gen_vsetvl_pat (prop.get_insn ()->rtl (), prop); > local_dem = prop; > local_dem.set_dirty (); > - local_dem.set_dirty_pat (dirty_pat); > reaching_out = local_dem; > } > else > @@ -2507,10 +2496,17 @@ pass_vsetvl::commit_vsetvls (void) > if (!reaching_out.dirty_p ()) > continue; > > - rtx new_pat = reaching_out.get_dirty_pat (); > + > + rtx new_pat; > if (can_refine_vsetvl_p (cfg_bb, reaching_out.get_ratio ())) > new_pat > = gen_vsetvl_pat (VSETVL_VTYPE_CHANGE_ONLY, reaching_out, > NULL_RTX); > + else if (vlmax_avl_p (reaching_out.get_avl ())) > + new_pat = gen_vsetvl_pat (VSETVL_NORMAL, reaching_out, > + get_vl (reaching_out.get_insn ()->rtl > ())); > + else > + new_pat > + = gen_vsetvl_pat (VSETVL_DISCARD_RESULT, reaching_out, NULL_RTX); > > start_sequence (); > emit_insn (new_pat); > diff --git a/gcc/config/riscv/riscv-vsetvl.h > b/gcc/config/riscv/riscv-vsetvl.h > index dc16c55b918..563ad3084ed 100644 > --- a/gcc/config/riscv/riscv-vsetvl.h > +++ b/gcc/config/riscv/riscv-vsetvl.h > @@ -220,13 +220,6 @@ private: > (with AVL included) before vmv.x.s, but vmv.x.s is not the INSN > holding the > definition of AVL. */ > rtl_ssa::insn_info *m_insn; > - /* Save instruction pattern for Dirty block. > - Since empty block may be polluted as a dirty block during dem > backward > - propagation (phase 3) which is intending to cheat LCM there is a > VSETVL > - instruction here to gain better LCM optimization. Such instruction > is not > - emit yet, we save this here and then emit it in the 4th phase if it > is > - necessary. */ > - rtx m_dirty_pat; > > /* Parse the instruction to get VL/VTYPE information and demanding > * information. */ > @@ -243,7 +236,7 @@ private: > public: > vector_insn_info () > : vl_vtype_info (), m_state (UNINITIALIZED), m_demands{false}, > - m_insn (nullptr), m_dirty_pat (NULL_RTX) > + m_insn (nullptr) > {} > > bool operator> (const vector_insn_info &) const; > @@ -271,7 +264,6 @@ public: > void set_unknown () { m_state = UNKNOWN; } > void set_empty () { m_state = EMPTY; } > void set_dirty () { m_state = DIRTY; } > - void set_dirty_pat (rtx pat) { m_dirty_pat = pat; } > void set_insn (rtl_ssa::insn_info *insn) { m_insn = insn; } > void set_demand_info (const vector_insn_info &); > > @@ -287,7 +279,6 @@ public: > vector_insn_info merge (const vector_insn_info &, bool) const; > > rtl_ssa::insn_info *get_insn () const { return m_insn; } > - rtx get_dirty_pat () const { return m_dirty_pat; } > > void dump (FILE *) const; > }; > -- > 2.36.1 > > --0000000000003aada005f32f9732--