[llvm] [CodeGen][PreISelIntrinsicLowering] Add VP-based lowering for memcpy/memmove/memset (PR #165585)

David Del Río via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 04:15:01 PST 2025


dadra-oc wrote:

> > I could modify that condition to check if the target machine is RISC-V. Another option would be to introduce a virtual method in TM that returns a target-specific preference which in the case of RISC-V could be the value of a command-line flag.
> 
> You could check `getPreferredTailFoldingStyle` from TTI returns `TailFoldingStyle::DataWithEVL`. That's what the vectorizer uses to determine VP intrinsic usage.

I added a function on TTI (`preferMemIntrinsicVPExpansion`)  instead of checking just if it supportScalableVector for deciding to expand them. 

> If you know the trip count is less than vlmax you could avoid a loop all together.

If I am not wrong this is already partially handled somewhere else. If the size is known at compile time and it does not exceed a given size (64 in the case RISCV) this won't take this expansion path. 




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


More information about the llvm-commits mailing list