-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasm32: Optimize small struct returns as integer values for better ABI efficiency #4757
Comments
Source in C++ ( define hidden noundef i32 @main() {
entry:
; [...]
%call = call i32 @sg_make_buffer(ptr noundef nonnull %b)
;[...]
}
; [...]
declare i32 @sg_make_buffer(ptr noundef) local_unnamed_addr #3 |
Analogous to #4741, we'd need a specific Edit: The main interesting point being that only these structs would need to be rewritten and passed as a primitive type:
|
To resolve ldc-developers#4757 and make our wasm ABI a bit more compatible with clang/emscripten's. This includes switching to 128-bit `real`.
To resolve ldc-developers#4757 and make our wasm ABI a bit more compatible with clang/emscripten's. This includes switching to 128-bit `real`.
To resolve ldc-developers#4757 and make our wasm ABI a bit more compatible with clang/emscripten's. This includes switching to 128-bit `real`.
The current implementation of LDC2 (latest-CI) is using the struct return (
sret
) mechanism for all struct returns, including small structs that could fit in a single register. This approach, while general and correct, may lead to suboptimal performance for small structs, especially on targets like wasm32-emscripten.Note: They both have the same configuration, increasing the
-sSTACK_SIZE=512KB
.full LLVM-IR: https://gist.github.com/kassane/bbae501db913ccceaa9b600b1e0930b7 (ReleaseMode)
LLVM-IR (
sg_make_buffer
)Based code:
D binding
cube
outputldc2-flags to llvmIR
Could it be possible to simplify the function's return rather than
sret
?Reference
RuntimeError
kassane/sokol-d#22The text was updated successfully, but these errors were encountered: