Address comment.
juzhe.zh...@rivai.ai From: Jeff Law Date: 2023-06-23 22:57 To: juzhe.zhong; gcc-patches CC: rguenther; richard.sandiford Subject: Re: [PATCH] DSE: Add LEN_MASK_STORE analysis into DSE On 6/23/23 08:48, juzhe.zh...@rivai.ai wrote: > From: Ju-Zhe Zhong <juzhe.zh...@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); So isn't len_size here the size in elements? If so, don't you need to multiply len_size by the element size? Jeff