-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Labels
Description
See this godbolt: link.
define void @suboptimal_memset(ptr) #0 {
call void @llvm.memset.p0.i32(ptr align 1 %0, i8 0, i32 16, i1 false)
ret void
}suboptimal_memset: # @suboptimal_memset
local.get 0
i64.const 0
i64.store 0:p2align=0
local.get 0
i32.const 8
i32.add
i64.const 0
i64.store 0:p2align=0
end_functionLowering doesn't add the no-wrapping attributes necessary to form WASM address modes. It could, however, as the LLVM model assumes that the destination must be dereferenceable (some prior optimization even adds an attribute to that effect).
Frontend-wise, this forces us to emit a sequence of stores/loads instead of a simple memcpy/memset, so that LLVM reverse folds them back if there are enough. This bloats the IR and complicates code.
Reactions are currently unavailable