1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Don't copy information from aliasee to alias.

They are independent.

llvm-svn: 254541
This commit is contained in:
Rafael Espindola 2015-12-02 20:03:17 +00:00
parent e243a08968
commit 5354070607
5 changed files with 20 additions and 22 deletions

View File

@ -411,12 +411,14 @@ void Function::clearGC() {
}
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a Function) from the Function Src to this one.
/// Copy all additional attributes (those not needed to create a Function) from
/// the Function Src to this one.
void Function::copyAttributesFrom(const GlobalValue *Src) {
assert(isa<Function>(Src) && "Expected a Function!");
GlobalObject::copyAttributesFrom(Src);
const Function *SrcF = cast<Function>(Src);
const Function *SrcF = dyn_cast<Function>(Src);
if (!SrcF)
return;
setCallingConv(SrcF->getCallingConv());
setAttributes(SrcF->getAttributes());
if (SrcF->hasGC())

View File

@ -97,10 +97,11 @@ void GlobalObject::setGlobalObjectSubClassData(unsigned Val) {
}
void GlobalObject::copyAttributesFrom(const GlobalValue *Src) {
const auto *GV = cast<GlobalObject>(Src);
GlobalValue::copyAttributesFrom(GV);
setAlignment(GV->getAlignment());
setSection(GV->getSection());
GlobalValue::copyAttributesFrom(Src);
if (const auto *GV = dyn_cast<GlobalObject>(Src)) {
setAlignment(GV->getAlignment());
setSection(GV->getSection());
}
}
const char *GlobalValue::getSection() const {
@ -216,14 +217,14 @@ void GlobalVariable::setInitializer(Constant *InitVal) {
}
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a GlobalVariable) from the GlobalVariable Src to this one.
/// Copy all additional attributes (those not needed to create a GlobalVariable)
/// from the GlobalVariable Src to this one.
void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) {
assert(isa<GlobalVariable>(Src) && "Expected a GlobalVariable!");
GlobalObject::copyAttributesFrom(Src);
const GlobalVariable *SrcVar = cast<GlobalVariable>(Src);
setThreadLocalMode(SrcVar->getThreadLocalMode());
setExternallyInitialized(SrcVar->isExternallyInitialized());
if (const GlobalVariable *SrcVar = dyn_cast<GlobalVariable>(Src)) {
setThreadLocalMode(SrcVar->getThreadLocalMode());
setExternallyInitialized(SrcVar->isExternallyInitialized());
}
}

View File

@ -593,12 +593,7 @@ static void forceRenaming(GlobalValue *GV, StringRef Name) {
/// from the SrcGV to the DestGV.
void ModuleLinker::copyGVAttributes(GlobalValue *NewGV,
const GlobalValue *SrcGV) {
auto *GA = dyn_cast<GlobalAlias>(SrcGV);
if (GA && !dyn_cast<GlobalAlias>(NewGV)) {
// FIXME: this is likelly bogus:
NewGV->copyAttributesFrom(GA->getBaseObject());
} else
NewGV->copyAttributesFrom(SrcGV);
NewGV->copyAttributesFrom(SrcGV);
forceRenaming(NewGV, getName(SrcGV));
}

View File

@ -1,6 +1,6 @@
$c = comdat any
@v2 = weak global i32 0, comdat ($c)
@v2 = weak dllexport global i32 0, comdat ($c)
define i32* @f2() {
ret i32* @v2
}

View File

@ -5,5 +5,5 @@ $c = comdat any
@v = global i32 0, comdat ($c)
; CHECK: @v = global i32 0, comdat($c)
; CHECK: @v2 = extern_weak global i32
; CHECK: @v2 = extern_weak dllexport global i32
; CHECK: @v3 = extern_weak global i32