hubert.reinterpretcast added a comment. In D150221#4347840 <https://reviews.llvm.org/D150221#4347840>, @efriedma wrote:
>> This is an adaptation of the IBM XL compiler's -qstatsym option, which is >> meant to generate symbol table entries for static variables. An artifact of >> that compiler is that static variables are often not discarded even when >> unused. > > Oh, I see; the compiler actually doesn't guarantee that the variables are > preserved, it just ends up preserving them by accident because it's bad at > optimizing global variables? That is my understanding, yes. However, that behaviour seems to serve the use case: Users can enable functions for hot-patching proactively to allow for bug fixes in live instances, and they would not necessarily know which static variables they need preserved for use in the replacement code up front. Additionally, sometimes the variables are not eliminated but their location is obfuscated by GlobalMerge (and potentially other optimizations). The `-fkeep-static-variables` option only addresses the use case when users do not apply LTO though. LTO internalization exposes more variables to the obfuscation/removal issue. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150221/new/ https://reviews.llvm.org/D150221 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits