mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Re-fix the issue Bill fixed in r147899 in a slightly different way, which doesn't abuse the semantics of linker_private. We don't really want to merge any string constant with a weak_odr global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147971 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -140,8 +140,11 @@ bool ConstantMerge::runOnModule(Module &M) {
|
||||
UsedGlobals.count(GV))
|
||||
continue;
|
||||
|
||||
// Ignore any constants which may be removed by the linker.
|
||||
if (GV->mayBeRemovedByLinker())
|
||||
// This transformation is legal for weak ODR globals in the sense it
|
||||
// doesn't change semantics, but we really don't want to perform it
|
||||
// anyway; it's likely to pessimize code generation, and some tools
|
||||
// (like the Darwin linker in cases involving CFString) don't expect it.
|
||||
if (GV->isWeakForLinker())
|
||||
continue;
|
||||
|
||||
Constant *Init = GV->getInitializer();
|
||||
@ -172,9 +175,8 @@ bool ConstantMerge::runOnModule(Module &M) {
|
||||
UsedGlobals.count(GV))
|
||||
continue;
|
||||
|
||||
// We can only replace constants with local linkage and which aren't
|
||||
// removed by the linker.
|
||||
if (!GV->hasLocalLinkage() || GV->mayBeRemovedByLinker())
|
||||
// We can only replace constant with local linkage.
|
||||
if (!GV->hasLocalLinkage())
|
||||
continue;
|
||||
|
||||
Constant *Init = GV->getInitializer();
|
||||
|
Reference in New Issue
Block a user