1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00

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

hypothetical future boog.

llvm-svn: 25430
This commit is contained in:
Chris Lattner 2006-01-19 00:46:54 +00:00
parent 197d33ce21
commit d5a7ceda96

View File

@ -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);