From 4e2288b9de2fc30d4b88b437c86594cd8ec332fa Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 6 Jun 2007 20:51:41 +0000 Subject: [PATCH] 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 --- lib/Transforms/IPO/Internalize.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index f1b2251b302..7b5392c0d9b 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;