diff options
author | Chris Lattner <sabre@nondot.org> | 2006-01-19 00:46:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-01-19 00:46:54 +0000 |
commit | 727552bb899688f9fc473651bef67d4105597b8f (patch) | |
tree | 0202403bf04038d1ba4053ab2094a970394df16a /lib/Transforms | |
parent | ee9e14cb8ab8e613bc6642396aaada20695b9458 (diff) |
If not internalizing, don't mark llvm.global[cd]tors const, as a fix for a
hypothetical future boog.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/Internalize.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index d583d88868..861b79a4e0 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -126,12 +126,15 @@ bool InternalizePass::runOnModule(Module &M) { // 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); |