[llvm] [WebAssembly] Protect memory.fill and memory.copy from zero-length ranges. (PR #112617)

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 00:15:14 PDT 2024


================
@@ -21,16 +21,33 @@ multiclass BULK_I<dag oops_r, dag iops_r, dag oops_s, dag iops_s,
 }
 
 // Bespoke types and nodes for bulk memory ops
+
+// memory.copy (may trap on empty ranges)
+def wasm_memory_copy_t : SDTypeProfile<0, 5,
+  [SDTCisInt<0>, SDTCisInt<1>, SDTCisPtrTy<2>, SDTCisPtrTy<3>, SDTCisInt<4>]
+>;
----------------
aheejin wrote:

This seems identical to the existing `wasm_memcpy_t`.. Can we reuse it in both places? The same for `wasm_memory_fill_t`.

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


More information about the llvm-commits mailing list