From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7928) id 43137385771C; Mon, 21 Aug 2023 09:29:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43137385771C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692610190; bh=3miRngQKIdMFe4oqmZVogIy1N/WY3clPfY66F8bwFew=; h=From:To:Subject:Date:From; b=VIPd3NdoL+gtcSL3AdakKG3PkTqZWRL/j9u2U/pMbFY2vAFK+w1W/acDVtj+pHOjR NOTQVZksqW5UrSHbHw9t7wbzYonQbUzQXn7O5r9ivPZGzYMDoslK0RWZBXv6mW+keR pfjmqFHyQm8P3mZydFVNSfZbAuE4i3J8Beay4jCM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Lehua Ding To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-3352] LCM: Export 2 helpful functions as global for VSETVL PASS use in RISC-V backend X-Act-Checkin: gcc X-Git-Author: Juzhe-Zhong X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 966b0a96523fb7adbf498ac71df5e033c70dc546 X-Git-Newrev: d5dfba19aee783a6ba90fdba1993d576c7ec310b Message-Id: <20230821092950.43137385771C@sourceware.org> Date: Mon, 21 Aug 2023 09:29:50 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d5dfba19aee783a6ba90fdba1993d576c7ec310b commit r14-3352-gd5dfba19aee783a6ba90fdba1993d576c7ec310b Author: Juzhe-Zhong Date: Mon Aug 21 09:04:53 2023 +0800 LCM: Export 2 helpful functions as global for VSETVL PASS use in RISC-V backend This patch exports 'compute_antinout_edge' and 'compute_earliest' as global scope which is going to be used in VSETVL PASS of RISC-V backend. The demand fusion is the fusion of VSETVL information to emit VSETVL which dominate and pre-config for most of the RVV instructions in order to elide redundant VSETVLs. For exmaple: for for for if (cond} VSETVL demand 1: SEW/LMUL = 16 and TU policy else VSETVL demand 2: SEW = 32 VSETVL pass should be able to fuse demand 1 and demand 2 into new demand: SEW = 32, LMUL = M2, TU policy. Then emit such VSETVL at the outmost of the for loop to get the most optimal codegen and run-time execution. Currenty the VSETVL PASS Phase 3 (demand fusion) is really messy and un-reliable as well as un-maintainable. And, I recently read dragon book and morgan's book again, I found there "earliest" can allow us to do the demand fusion in a very reliable and optimal way. So, this patch exports these 2 functions which are very helpful for VSETVL pass. gcc/ChangeLog: * lcm.cc (compute_antinout_edge): Export as global use. (compute_earliest): Ditto. (compute_rev_insert_delete): Ditto. * lcm.h (compute_antinout_edge): Ditto. (compute_earliest): Ditto. Diff: --- gcc/lcm.cc | 7 ++----- gcc/lcm.h | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/lcm.cc b/gcc/lcm.cc index 94a3ed43aeab..03421e490e46 100644 --- a/gcc/lcm.cc +++ b/gcc/lcm.cc @@ -56,9 +56,6 @@ along with GCC; see the file COPYING3. If not see #include "lcm.h" /* Edge based LCM routines. */ -static void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *); -static void compute_earliest (struct edge_list *, int, sbitmap *, sbitmap *, - sbitmap *, sbitmap *, sbitmap *); static void compute_laterin (struct edge_list *, sbitmap *, sbitmap *, sbitmap *, sbitmap *); static void compute_insert_delete (struct edge_list *edge_list, sbitmap *, @@ -79,7 +76,7 @@ static void compute_rev_insert_delete (struct edge_list *edge_list, sbitmap *, This is done based on the flow graph, and not on the pred-succ lists. Other than that, its pretty much identical to compute_antinout. */ -static void +void compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin, sbitmap *antout) { @@ -170,7 +167,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin, /* Compute the earliest vector for edge based lcm. */ -static void +void compute_earliest (struct edge_list *edge_list, int n_exprs, sbitmap *antin, sbitmap *antout, sbitmap *avout, sbitmap *kill, sbitmap *earliest) diff --git a/gcc/lcm.h b/gcc/lcm.h index e08339352e03..7145d6fc46df 100644 --- a/gcc/lcm.h +++ b/gcc/lcm.h @@ -31,4 +31,7 @@ extern struct edge_list *pre_edge_rev_lcm (int, sbitmap *, sbitmap *, sbitmap *, sbitmap *, sbitmap **, sbitmap **); +extern void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *); +extern void compute_earliest (struct edge_list *, int, sbitmap *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *); #endif /* GCC_LCM_H */