mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-11 12:11:20 +00:00
Fix PR1645 by resolving forward alias references.
llvm-svn: 41815
This commit is contained in:
parent
e017870ae6
commit
c94e3e9361
@ -2129,6 +2129,27 @@ Definition
|
|||||||
CurModule.CurrentModule);
|
CurModule.CurrentModule);
|
||||||
GA->setVisibility($2);
|
GA->setVisibility($2);
|
||||||
InsertValue(GA, CurModule.Values);
|
InsertValue(GA, CurModule.Values);
|
||||||
|
|
||||||
|
|
||||||
|
// If there was a forward reference of this alias, resolve it now.
|
||||||
|
|
||||||
|
ValID ID;
|
||||||
|
if (!Name.empty())
|
||||||
|
ID = ValID::createGlobalName(Name);
|
||||||
|
else
|
||||||
|
ID = ValID::createGlobalID(CurModule.Values.size()-1);
|
||||||
|
|
||||||
|
if (GlobalValue *FWGV =
|
||||||
|
CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
|
||||||
|
// Replace uses of the fwdref with the actual alias.
|
||||||
|
FWGV->replaceAllUsesWith(GA);
|
||||||
|
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
|
||||||
|
GV->eraseFromParent();
|
||||||
|
else
|
||||||
|
cast<Function>(FWGV)->eraseFromParent();
|
||||||
|
}
|
||||||
|
ID.destroy();
|
||||||
|
|
||||||
CHECK_FOR_ERROR
|
CHECK_FOR_ERROR
|
||||||
}
|
}
|
||||||
| TARGET TargetDefinition {
|
| TARGET TargetDefinition {
|
||||||
|
9
test/Assembler/2007-09-10-AliasFwdRef.ll
Normal file
9
test/Assembler/2007-09-10-AliasFwdRef.ll
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
; RUN: llvm-as < %s | llvm-dis
|
||||||
|
; PR1645
|
||||||
|
|
||||||
|
@__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*)
|
||||||
|
@__gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
declare extern_weak i32 @pthread_cancel(i32)
|
Loading…
x
Reference in New Issue
Block a user