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

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 05:50:46 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;
----------------
badumbatish wrote:

I think it depends on if the backend overrides the default settings or not, aarch64 and risc-v has 8 and 4 respectively like you said.

I can try those values out.

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


More information about the llvm-commits mailing list