diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-26 05:30:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-26 05:30:40 +0000 |
commit | 81d4e14449fce69ca3a315685a80bb3c20a3db23 (patch) | |
tree | 0edc0d125aa15f5777948318d6345061a89da80f | |
parent | dc523538338a1474caa0bc477f00498f58b34d46 (diff) | |
download | external_llvm-81d4e14449fce69ca3a315685a80bb3c20a3db23.zip external_llvm-81d4e14449fce69ca3a315685a80bb3c20a3db23.tar.gz external_llvm-81d4e14449fce69ca3a315685a80bb3c20a3db23.tar.bz2 |
When internalizing global ctor/dtor list, also mark it constant. This is gross, but
until DSA is working all of the time and is totally reliable, we do this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6917 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/IPO/Internalize.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index ec28ecf..0ed76ab 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -87,6 +87,14 @@ namespace { for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) if (!I->isExternal() && !I->hasInternalLinkage() && !ExternalNames.count(I->getName())) { + // Special case handling of the global ctor and dtor list. When we + // internalize it, we mark it constant, which allows elimination of + // the list if it's empty. + // + if (I->hasAppendingLinkage() && (I->getName() == "llvm.global_ctors"|| + I->getName() == "llvm.global_dtors")) + I->setConstant(true); + I->setLinkage(GlobalValue::InternalLinkage); Changed = true; ++NumGlobals; |