[llvm-commits] CVS: llvm/lib/Transforms/IPO/Internalize.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 18 16:47:05 PST 2006



Changes in directory llvm/lib/Transforms/IPO:

Internalize.cpp updated: 1.29 -> 1.30
---
Log message:

If not internalizing, don't mark llvm.global[cd]tors const, as a fix for a
hypothetical future boog.


---
Diffs of the changes:  (+5 -2)

 Internalize.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/IPO/Internalize.cpp
diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.29 llvm/lib/Transforms/IPO/Internalize.cpp:1.30
--- llvm/lib/Transforms/IPO/Internalize.cpp:1.29	Wed Jan 18 18:40:39 2006
+++ llvm/lib/Transforms/IPO/Internalize.cpp	Wed Jan 18 18:46:54 2006
@@ -126,12 +126,15 @@
       //
       if (I->hasAppendingLinkage() && (I->getName() == "llvm.global_ctors" ||
                                        I->getName() == "llvm.global_dtors")) {
-        I->setConstant(true);
-        
         // 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);






More information about the llvm-commits mailing list