[llvm] [polly] Slightly improve the getenv("bar") linking problem (PR #150020)
Luke Drummond via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 07:32:29 PDT 2025
================
@@ -22,12 +22,10 @@ namespace {
ForceAsmWriterLinking() {
// We must reference the plug-ins in such a way that compilers will not
// delete it all as dead code, even with whole program optimization,
- // yet is effectively a NO-OP. As the compiler isn't smart enough
- // to know that getenv() never returns -1, this will do the job.
- // This is so that globals in the translation units where these functions
- // are defined are forced to be initialized, populating various
- // registries.
- if (std::getenv("bar") != (char*) -1)
+ // yet is effectively a NO-OP. This is so that globals in the translation
+ // units where these functions are defined are forced to be initialized,
+ // populating various registries.
+ if (llvm::getNonFoldableAlwaysTrue())
----------------
ldrumm wrote:
I've taken a quick tour of `llvm/include/llvm/Support` and don't see any extant header that would suit. Are you open to a new small header, `AlwaysTrue.h`, in that directory?
https://github.com/llvm/llvm-project/pull/150020
More information about the llvm-commits
mailing list