[PATCH] D128726: [RISCV][NFC] Move static global variables into static variable in function.
Jessica Clarke via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 28 09:31:34 PDT 2022
jrtc27 added a comment.
The commit message is poor, because the problem is not the use of static globals, it's the use of globals that have constructors. Moving them to be static function-scoped variables doesn't change the fact that they still have static duration; you change the scope of them but not their storage. Implementations can defer their initialisation until the first time the function is called, but do not have to. Clang, GCC and MSVC all do in fact perform lazy initialisation (with all the overhead that comes with to make it thread-safe and exception-safe) so maybe this is fine in practice. Is there precedent for this?
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits