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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 22:17:01 PDT 2025


================
@@ -46,6 +46,10 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
     : TargetLowering(TM), Subtarget(&STI) {
   auto MVTPtr = Subtarget->hasAddr64() ? MVT::i64 : MVT::i32;
 
+  // Set the load count for memcmp expand optimization
+  MaxLoadsPerMemcmp = 3;
+  MaxLoadsPerMemcmpOptSize = 2;
----------------
lukel97 wrote:

It would be good to test out what are some reasonable values for these defaults. AArch64 and RISC-V are a bit more lenient and use 8 and 4 respectively

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


More information about the llvm-commits mailing list