Why Zig memsets allocated memory even in ReleaseFast?

Seems like a big regression, and pretty straightforward to fix. Likely this flew under the radar with the new compiler implementation. @memset to undefined is certainly supposed to be a no-op in ReleaseFast optimization mode. In theory this is LLVM’s fault since memset to undefined technically helps the optimizer more than a no-op does, but if it can’t handle it in practice then Zig should simply omit it in the LLVM backend.

4 Likes