summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/Internalize.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-06-06 20:51:41 +0000
committerChris Lattner <sabre@nondot.org>2007-06-06 20:51:41 +0000
commit4e2288b9de2fc30d4b88b437c86594cd8ec332fa (patch)
tree725b967cc1e0966ca575c8bee3adeead680ee43d /lib/Transforms/IPO/Internalize.cpp
parent037a704f4ffde640e38df71b68f17efcc729298f (diff)
downloadllvm-4e2288b9de2fc30d4b88b437c86594cd8ec332fa.tar.gz
llvm-4e2288b9de2fc30d4b88b437c86594cd8ec332fa.tar.bz2
llvm-4e2288b9de2fc30d4b88b437c86594cd8ec332fa.tar.xz
simplify this code and fix PR1493, now that llvm-gcc3 is dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/Internalize.cpp')
-rw-r--r--lib/Transforms/IPO/Internalize.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index f1b2251b30..7b5392c0d9 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -128,29 +128,14 @@ bool InternalizePass::runOnModule(Module &M) {
ExternalNames.insert("llvm.dbg.compile_units");
ExternalNames.insert("llvm.dbg.global_variables");
ExternalNames.insert("llvm.dbg.subprograms");
+ ExternalNames.insert("llvm.global_ctors");
+ ExternalNames.insert("llvm.global_dtors");
// Mark all global variables with initializers as internal as well.
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I)
if (!I->isDeclaration() && !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")) {
- // If the global ctors/dtors list has no uses, do not internalize it, as
- // there is no __main in this program, so the asmprinter should handle
- // it.
- if (I->use_empty()) continue;
-
- // Otherwise, also mark the list constant, as we know that it will not
- // be mutated any longer, and the makes simple IPO xforms automatically
- // better.
- I->setConstant(true);
- }
-
I->setLinkage(GlobalValue::InternalLinkage);
Changed = true;
++NumGlobals;