mirror of
https://github.com/ziglang/zig.git
synced 2025-12-24 15:13:08 +00:00
This valid zig code produces reasonable LLVM IR, however, on the wasm32-wasi target, when using the wasmtime runtime, the number of locals of the `isSquare` function exceeds 50000, causing wasmtime to refuse to execute the binary. The `inline` keyword in Zig is intended to be used only where it is semantically necessary; not as an optimization hint. Otherwise, this may produce unwanted binary bloat for the -OReleaseSmall use case. In the future, it is possible that we may end up with both `inline` keyword, which operates as it does in status quo, and additionally `callconv(.inline_hint)` which has no semantic impact, but may be observed by optimization passes. In this commit, I also cleaned up `isSquare` by eliminating an unnecessary mutable variable, replacing it with several local constants. Closes #11947.