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

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 07:57:45 PDT 2025


asb wrote:

> Reverse ping. Can you rebase this?

Just catching up post EuroLLVM. I've resolved the merge conflicts now, and fixed and outdated comment and accepted your suggestion (thanks!). And now putting some more focused effort in getting this closed off.

I have a flow for looking for unexpected codegen differences (which should only show up on darwin where the libcall is supported) by applying a hacky patch that unconditionally marks memset_pattern16 as available on all platforms, then building the test-suite with `-k0` (to ignore link errors) and looking at assembly diffs. Going through this, there are a few things I'm looking at that need resolution before this can be merged:
* More minor
  * 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.
  * Loosing some type information in the emitted globals (bit patterns are the same, but before commented as 'float' etc appropriately). I've not looked at this as it's not a functional change.
  * In some examples we no longer tailcall memset_pattern16. Marking as minor as I didn't see a case it's likely to make a big difference, but it would be nice to clean up
* The bigger one is I see some examples with repeated memset_pattern16 calls that wasn't there before. After looking at some of the others, I'm now isolating a smaller example.

It's possible some of the above results in changes to this patch, but also equally possible they result in separate PRs that end up being effectively pre-requisites for this one.

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


More information about the llvm-commits mailing list