From: juzhe.zhong@rivai.ai
To: gcc-patches@gcc.gnu.org
Cc: rguenther@suse.de, richard.sandiford@arm.com,
Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Subject: [PATCH] DSE: Add LEN_MASK_STORE analysis into DSE
Date: Fri, 23 Jun 2023 22:48:47 +0800 [thread overview]
Message-ID: <20230623144847.85698-1-juzhe.zhong@rivai.ai> (raw)
From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
gcc/ChangeLog:
* tree-ssa-dse.cc (initialize_ao_ref_for_dse): Add LEN_MASK_STORE.
(dse_optimize_stmt): Ditto.
---
gcc/tree-ssa-dse.cc | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc
index 3c7a2e9992d..01b0951f1a9 100644
--- a/gcc/tree-ssa-dse.cc
+++ b/gcc/tree-ssa-dse.cc
@@ -174,6 +174,23 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write, bool may_def_ok = false)
return true;
}
break;
+ case IFN_LEN_MASK_STORE: {
+ /* We cannot initialize a must-def ao_ref (in all cases) but we
+ can provide a may-def variant. */
+ if (may_def_ok)
+ {
+ tree len_size
+ = int_const_binop (MINUS_EXPR, gimple_call_arg (stmt, 2),
+ gimple_call_arg (stmt, 5));
+ tree mask_size
+ = TYPE_SIZE_UNIT (TREE_TYPE (gimple_call_arg (stmt, 4)));
+ tree size = int_const_binop (MAX_EXPR, len_size, mask_size);
+ ao_ref_init_from_ptr_and_size (write, gimple_call_arg (stmt, 0),
+ size);
+ return true;
+ }
+ break;
+ }
default:;
}
}
@@ -1502,6 +1519,7 @@ dse_optimize_stmt (function *fun, gimple_stmt_iterator *gsi, sbitmap live_bytes)
{
case IFN_LEN_STORE:
case IFN_MASK_STORE:
+ case IFN_LEN_MASK_STORE:
{
enum dse_store_status store_status;
store_status = dse_classify_store (&ref, stmt, false, live_bytes);
--
2.36.3
next reply other threads:[~2023-06-23 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 14:48 juzhe.zhong [this message]
2023-06-23 14:57 ` Jeff Law
2023-06-23 23:19 ` 钟居哲
2023-06-26 6:28 ` Richard Biener
2023-06-26 6:39 ` juzhe.zhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230623144847.85698-1-juzhe.zhong@rivai.ai \
--to=juzhe.zhong@rivai.ai \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).