[llvm] [WebAssembly] Add support for memcmp expansion (PR #148298)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 21:56:33 PDT 2025


================
@@ -141,6 +141,16 @@ InstructionCost WebAssemblyTTIImpl::getCastInstrCost(
   return BaseT::getCastInstrCost(Opcode, Dst, Src, CCH, CostKind, I);
 }
 
+WebAssemblyTTIImpl::TTI::MemCmpExpansionOptions
+WebAssemblyTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
+  TTI::MemCmpExpansionOptions Options;
+  // INFO: I'm not sure what determines this, setting 2 conservatively
+  Options.NumLoadsPerBlock = 2;
+  Options.LoadSizes.append({8, 4, 2, 1});
----------------
lukel97 wrote:

Oh in that case yeah I think it's reasonable to start with just scalar sizes now and leave a TODO for vector sizes

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


More information about the llvm-commits mailing list