simplify this code and fix PR1493, now that llvm-gcc3 is dead.
authorChris Lattner <sabre@nondot.org>
Wed, 6 Jun 2007 20:51:41 +0000 (20:51 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 6 Jun 2007 20:51:41 +0000 (20:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37478 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/Internalize.cpp

index f1b2251b3027a32e501fcc639798cf76832e12c0..7b5392c0d9b12ee255c40980434050032acd3e9f 100644 (file)
@@ -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;