mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 02:22:29 +00:00
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:
@@ -87,6 +87,14 @@ namespace {
|
|||||||
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
|
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
|
||||||
if (!I->isExternal() && !I->hasInternalLinkage() &&
|
if (!I->isExternal() && !I->hasInternalLinkage() &&
|
||||||
!ExternalNames.count(I->getName())) {
|
!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);
|
I->setLinkage(GlobalValue::InternalLinkage);
|
||||||
Changed = true;
|
Changed = true;
|
||||||
++NumGlobals;
|
++NumGlobals;
|
||||||
|
|||||||
Reference in New Issue
Block a user