https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104550

--- Comment #16 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 17 Feb 2022, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104550
> 
> --- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to qinzhao from comment #11)
> > (In reply to Jakub Jelinek from comment #10)
> > > Even in that case, filling the memory with pattern & mask instead of 
> > > filling
> > > the memory with pattern + __builtin_clear_padding afterwards seems like a
> > > win.
> > 
> > So, you mean It's better to do the following for pattern init:
> > 
> > 1. add call to .DEFERRED_INIT(, pattern, ) during gimplification;
> > 2. during RTL expansion, fill the memory with pattern & mask if the variable
> > is in memory. 
> > 
> > how to implement "fill the memory with pattern & mask" during RTL expansion?
> > currently, we use memset to fill the memory when the variable is in memory,
> > pattern & mask might not fit to a BYTE-repeatable pattern that can be used
> > for memset?
> 
> You can populate a buffer with the pattern and then 
> clear_type_padding_in_mask.
> Then you can create a STRING_CST out from that array and store_expr
> (the_STRING_CST, DECL_RTL (var), false, false, false) - at least when DECL_RTL
> (var) is a MEM.

It would of course be _highly_ desirable to _not_ need to build a
STRING_CST here.  The problematical cases are all when DECL_RTL isn't
a MEM, of course.

Reply via email to