LLVM: lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp File Reference (original) (raw)
This file implements an optimization pass using memory intrinsic results. More...
This file implements an optimization pass using memory intrinsic results.
Calls to memory intrinsics (memcpy, memmove, memset) return the destination address. They are in the form of dst_new = call @memcpy dst, src, len where dst and dst_new registers contain the same value.
This is to enable an optimization wherein uses of the dst register used in the parameter can be replaced by uses of the dst_new register used in the result, making the dst register more likely to be single-use, thus more likely to be useful to register stackifying, and potentially also exposing the call instruction itself to register stackifying. These both can reduce local.get/local.set traffic.
The LLVM intrinsics for these return void so they can't use the returned attribute and consequently aren't handled by the OptimizeReturned pass.
Definition in file WebAssemblyMemIntrinsicResults.cpp.