Skip to content

Commit 62974b8

Browse files
committed
Remove WebAssemblyISD::MEMORY_COPY and add comments.
1 parent 67a59c9 commit 62974b8

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyISD.def

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ HANDLE_NODETYPE(PROMOTE_LOW)
4242
HANDLE_NODETYPE(TRUNC_SAT_ZERO_S)
4343
HANDLE_NODETYPE(TRUNC_SAT_ZERO_U)
4444
HANDLE_NODETYPE(DEMOTE_ZERO)
45-
HANDLE_NODETYPE(MEMORY_COPY)
46-
HANDLE_NODETYPE(MEMORY_FILL)
4745
HANDLE_NODETYPE(I64_ADD128)
4846
HANDLE_NODETYPE(I64_SUB128)
4947
HANDLE_NODETYPE(I64_MUL_WIDE_S)
@@ -55,6 +53,9 @@ HANDLE_MEM_NODETYPE(GLOBAL_SET)
5553
HANDLE_MEM_NODETYPE(TABLE_GET)
5654
HANDLE_MEM_NODETYPE(TABLE_SET)
5755

58-
// Bulk memory instructions that require branching to handle empty ranges.
56+
// Bulk memory instructions. These follow LLVM's expected semantics of
57+
// supporting out-of-bounds pointers if the length is zero, by insertig
58+
// a branch around Wasm's `memory.copy` and `memory.fill`, which would
59+
// otherwise trap.
5960
HANDLE_NODETYPE(MEMCPY)
6061
HANDLE_NODETYPE(MEMSET)

llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,13 @@ def wasm_memset_t : SDTypeProfile<0, 4,
2929
[SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisInt<2>, SDTCisInt<3>]
3030
>;
3131

32-
// memory.copy (may trap on empty ranges)
33-
def wasm_memory_copy : SDNode<"WebAssemblyISD::MEMORY_COPY", wasm_memcpy_t,
34-
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;
35-
36-
// memory.copy with a branch to avoid trapping
32+
// memory.copy with a branch to avoid trapping in the case of out-of-bounds
33+
// pointers with empty ranges.
3734
def wasm_memcpy : SDNode<"WebAssemblyISD::MEMCPY", wasm_memcpy_t,
3835
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;
3936

40-
// memory.fill (may trap on empty ranges)
41-
def wasm_memory_fill : SDNode<"WebAssemblyISD::MEMORY_FILL", wasm_memset_t,
42-
[SDNPHasChain, SDNPMayStore]>;
43-
44-
// memory.fill with a branch to avoid trapping
37+
// memory.fill with a branch to avoid trapping in the case of out-of-bounds
38+
// pointers with empty ranges.
4539
def wasm_memset : SDNode<"WebAssemblyISD::MEMSET", wasm_memset_t,
4640
[SDNPHasChain, SDNPMayStore]>;
4741

0 commit comments

Comments
 (0)