[llvm] [IR] Initial introduction of memset_pattern (PR #97583)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 09:32:54 PDT 2024


https://github.com/preames commented:

I think I agree with @nikic that long term, what we want here is not a separate memset.pattern, but a type parameter to memset.  However, I'm leery of this being stuck in review indefinitely.  Perfection is the enemy of the good.

Here's my suggestion on a path forward here:
* We add the new intrinsic, but explicitly mark it experimental.  This ensures we can change/remove it freely without backwards compat concerns during the next couple steps.
* At the initial stage, memset.pattern would *not* be a memset (in particular, no longer in MemSetInst).
* We'd implement initial lowering, and optimization in terms of the intrinsic.  Feel through the design, make sure we haven't gotten anything wrong.
* Once we're comfortable, we generalize memset with a type param.  At this point, this is a semantically interesting change, but little new code required (it all exists for the pattern variant).  Initially, update the semantics, and lowering.
* Then switch over the optimizations to generate the memset with type param form and delete the intrinsic.

If we don't like the idea of the experimental stepping stone, another idea would be to generalize the existing memset.inline with a type param, and then work our way to the full memset via that path.  

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


More information about the llvm-commits mailing list