[llvm] [PreISelIntrinsicLowering] Produce a memset_pattern16 libcall for llvm.experimental.memset.pattern when available (PR #120420)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 08:47:23 PST 2025


================
@@ -323,7 +378,51 @@ bool PreISelIntrinsicLowering::expandMemIntrinsicUses(Function &F) const {
     }
     case Intrinsic::experimental_memset_pattern: {
       auto *Memset = cast<MemSetPatternInst>(Inst);
-      expandMemSetPatternAsLoop(Memset);
+      const TargetLibraryInfo &TLI = LookupTLI(*Memset->getFunction());
+      if (Constant *PatternValue = getMemSetPattern16Value(Memset, TLI)) {
----------------
preames wrote:

You should use early return here for the case where we have to expand via a loop.  The duplicated code in the tail is pretty minor.  

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


More information about the llvm-commits mailing list