[llvm] [LoopIdiom] Select llvm.experimental.memset.pattern intrinsic rather than memset_pattern16 libcall (PR #126736)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 14:18:50 PDT 2025


nikic wrote:

> Duplicated globals vs before. The linker can clean it up, and tracing through it's just because of things like inlining, where before we made one global in LoopIdiomRecognize and later may have cloned the call that uses it. But now, we may clone the intrinsic call and then create a global for each one that is lowered to memset_pattern16.

Interesting case. This makes me wonder whether it would make sense to do the expansion for this intrinsic earlier, in the late middle-end pipeline (we'd still have to keep it in the backend for O0 fallback). If we do it before ConstantMerge, it would merge the constants back together. More interestingly, if we do it before addVectorPasses, the loop expansion case would still get the usual vectorization and unrolling heuristics, which would avoid the need to consider those in the backend expansion.

I don't think the duplicate globals are a big problem though, so that's just a thought on how to improve things in the future...

https://github.com/llvm/llvm-project/pull/126736


More information about the llvm-commits mailing list