-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Description
I noticed this a bit surprising code quality regression while trying out the new LLVM that uses bulk memory by default.
C source:
void test_fill(int* d, int* s) {
__builtin_memset(d, 0, 128);
}
void test_copy(int* d, int* s) {
__builtin_memcpy(d, s, 128);
}
Output:
test_fill(int*, int*):
block
i32.const 128
i32.eqz
br_if 0
local.get 0
i32.const 0
i32.const 128
memory.fill 0
end_block
end_function
test_copy(int*, int*):
block
i32.const 128
i32.eqz
br_if 0
local.get 0
local.get 1
i32.const 128
memory.copy 0, 0
end_block
end_function
Notice the useless checks.