[llvm-dev] array fill idioms

Bagel via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 28 09:38:06 PST 2016


Philip, thank you for your comments.

I already use memset for byte patterns, but was unaware of memset_patternX; I
will look into it.  Based on your observations, I guess I will go ahead with
the naive store loop approach for now and hope for "llvm.fill.*" in the future.

Thanks, bagel.


On 11/25/2016 05:46 PM, Philip Reames wrote:
> Take a look an memset (byte patterns), and memset_patternX (multi byte
> patterns, only currently supported for selective targets).  In general, support
> for fill idioms is something we could stand to improve and it's something I or
> someone on my team is likely to be working on within the next year.
> 
> Today, the naive store loop is probably your best choice to have emitted by the
> frontend.  This loop will be nicely vectorized by the loop vectorizer,
> specialized if the loop length is known to be small, and otherwise decently
> handled.  The only serious problem with this implementation strategy is that
> you end up with many copies of the fill loop scattered throughout your code
> (code bloat).  (I'm assuming this gets aggressively inlined.  If it doesn't,
> well, then there are bigger problems.)
> 
> Moving forward, any further support we added would definitely handle pattern
> matching the naive loop constructs.  Given that, it's also reasonably future
> proof as well.
> 
> Philip



More information about the llvm-dev mailing list