When internalizing global ctor/dtor list, also mark it constant. This is gross, but

until DSA is working all of the time and is totally reliable, we do this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6917 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-06-26 05:30:40 +00:00
parent dc52353833
commit 81d4e14449

View File

@ -87,6 +87,14 @@ namespace {
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
if (!I->isExternal() && !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"))
I->setConstant(true);
I->setLinkage(GlobalValue::InternalLinkage);
Changed = true;
++NumGlobals;