JonChesterfield added a comment.

I've continued thinking about / experimenting with this. Curiously - `X x;` and 
`X x{};` are considered distinct by clang. The current patch will only accept 
the former. I'll add some tests for that.

I think there's a reasonable chance that the developers who want to elide the 
runtime cost of zero initialising will usually also want to avoid dynamic 
initialisation. That suggests we could accept only trivially default 
constructible classes, where the undef initializer is correct in that one 
cannot determine whether a no-op constructor actually ran or not. If we go with 
that, then the more complicated question of exactly how this should interact 
with user-controlled disabling of dynamic initialization can be postponed until 
that feature is introduced. This patch is then reasonably self contained.

This patch is strongly related to the linker script approach, or equivalent 
asm. It's target-dependent how the uninitialised data gets represented, e.g. 
x64 will put it in bss anyway. Opencl's __local is similarly uninitialised, and 
gets annotated with an address space that maps onto magic in llc and/or the 
loader.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74361/new/

https://reviews.llvm.org/D74361



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to