mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
LowerBitSets: do not use private aliases at all on Darwin.
LLVM currently turns these into linker-private symbols, which can be dead stripped by the Darwin linker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -349,9 +349,13 @@ void LowerBitSets::allocateByteArrays() {
|
|||||||
// Create an alias instead of RAUW'ing the gep directly. On x86 this ensures
|
// Create an alias instead of RAUW'ing the gep directly. On x86 this ensures
|
||||||
// that the pc-relative displacement is folded into the lea instead of the
|
// that the pc-relative displacement is folded into the lea instead of the
|
||||||
// test instruction getting another displacement.
|
// test instruction getting another displacement.
|
||||||
GlobalAlias *Alias = GlobalAlias::create(
|
if (LinkerSubsectionsViaSymbols) {
|
||||||
Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, M);
|
BAI->ByteArray->replaceAllUsesWith(GEP);
|
||||||
BAI->ByteArray->replaceAllUsesWith(Alias);
|
} else {
|
||||||
|
GlobalAlias *Alias = GlobalAlias::create(
|
||||||
|
Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, M);
|
||||||
|
BAI->ByteArray->replaceAllUsesWith(Alias);
|
||||||
|
}
|
||||||
BAI->ByteArray->eraseFromParent();
|
BAI->ByteArray->eraseFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,15 +533,16 @@ void LowerBitSets::buildBitSetsFromGlobals(
|
|||||||
ConstantInt::get(Int32Ty, I * 2)};
|
ConstantInt::get(Int32Ty, I * 2)};
|
||||||
Constant *CombinedGlobalElemPtr =
|
Constant *CombinedGlobalElemPtr =
|
||||||
ConstantExpr::getGetElementPtr(CombinedGlobal, CombinedGlobalIdxs);
|
ConstantExpr::getGetElementPtr(CombinedGlobal, CombinedGlobalIdxs);
|
||||||
GlobalValue::LinkageTypes GAliasLinkage = LinkerSubsectionsViaSymbols
|
if (LinkerSubsectionsViaSymbols) {
|
||||||
? GlobalValue::PrivateLinkage
|
Globals[I]->replaceAllUsesWith(CombinedGlobalElemPtr);
|
||||||
: Globals[I]->getLinkage();
|
} else {
|
||||||
GlobalAlias *GAlias = GlobalAlias::create(
|
GlobalAlias *GAlias = GlobalAlias::create(
|
||||||
Globals[I]->getType()->getElementType(),
|
Globals[I]->getType()->getElementType(),
|
||||||
Globals[I]->getType()->getAddressSpace(), GAliasLinkage,
|
Globals[I]->getType()->getAddressSpace(), Globals[I]->getLinkage(),
|
||||||
"", CombinedGlobalElemPtr, M);
|
"", CombinedGlobalElemPtr, M);
|
||||||
GAlias->takeName(Globals[I]);
|
GAlias->takeName(Globals[I]);
|
||||||
Globals[I]->replaceAllUsesWith(GAlias);
|
Globals[I]->replaceAllUsesWith(GAlias);
|
||||||
|
}
|
||||||
Globals[I]->eraseFromParent();
|
Globals[I]->eraseFromParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,10 +42,20 @@ target datalayout = "e-p:32:32"
|
|||||||
; CHECK: @b = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2)
|
; CHECK: @b = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2)
|
||||||
; CHECK: @c = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
|
; CHECK: @c = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
|
||||||
; CHECK: @d = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
|
; CHECK: @d = alias getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
|
||||||
; CHECK-DARWIN: @a = private alias
|
|
||||||
; CHECK-DARWIN: @b = private alias
|
; CHECK-DARWIN: @aptr = constant i32* getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G:@[^ ]*]], i32 0, i32 0)
|
||||||
; CHECK-DARWIN: @c = private alias
|
@aptr = constant i32* @a
|
||||||
; CHECK-DARWIN: @d = private alias
|
|
||||||
|
; CHECK-DARWIN: @bptr = constant [63 x i32]* getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2)
|
||||||
|
@bptr = constant [63 x i32]* @b
|
||||||
|
|
||||||
|
; CHECK-DARWIN: @cptr = constant i32* getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
|
||||||
|
@cptr = constant i32* @c
|
||||||
|
|
||||||
|
; CHECK-DARWIN: @dptr = constant [2 x i32]* getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
|
||||||
|
@dptr = constant [2 x i32]* @d
|
||||||
|
|
||||||
|
; CHECK-DARWIN: [[G]] = private constant
|
||||||
|
|
||||||
; CHECK: @bits = private alias getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
|
; CHECK: @bits = private alias getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
|
||||||
; CHECK: @bits1 = private alias getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
|
; CHECK: @bits1 = private alias getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0)
|
||||||
|
Reference in New Issue
Block a user