[ThinLTO] Fix FunctionImport alias checking and test
Skip imports for weak_any aliases as well. Fix the test to check non-import of weak aliases and functions, and import of normal alias. llvm-svn: 253991
This commit is contained in:
parent
b0bb6142f5
commit
17626654fd
|
@ -142,11 +142,12 @@ bool FunctionImporter::importFunctions(Module &M) {
|
|||
llvm_unreachable("Can't load function in Module");
|
||||
}
|
||||
|
||||
// We cannot import weak_any functions without possibly affecting the
|
||||
// order they are seen and selected by the linker, changing program
|
||||
// We cannot import weak_any functions/aliases without possibly affecting
|
||||
// the order they are seen and selected by the linker, changing program
|
||||
// semantics.
|
||||
if (F->hasWeakAnyLinkage()) {
|
||||
DEBUG(dbgs() << "Ignoring import request for weak-any function "
|
||||
if (SGV->hasWeakAnyLinkage()) {
|
||||
DEBUG(dbgs() << "Ignoring import request for weak-any "
|
||||
<< (isa<Function>(SGV) ? "function " : "alias ")
|
||||
<< CalledFunctionName << " from " << FileName << "\n");
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -74,12 +74,6 @@ entry:
|
|||
ret void
|
||||
}
|
||||
|
||||
define void @callweakfunc() #0 {
|
||||
entry:
|
||||
call void @weakfunc()
|
||||
ret void
|
||||
}
|
||||
|
||||
define internal i32 @staticfunc() #0 {
|
||||
entry:
|
||||
ret i32 1
|
||||
|
|
|
@ -15,12 +15,17 @@ entry:
|
|||
%call2 = call i32 (...) @referencecommon()
|
||||
call void (...) @setfuncptr()
|
||||
call void (...) @callfuncptr()
|
||||
call void (...) @callweakfunc()
|
||||
call void (...) @weakfunc()
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; Won't import alias
|
||||
; Won't import weak alias
|
||||
; CHECK-DAG: declare extern_weak void @weakalias()
|
||||
declare void @weakalias(...) #1
|
||||
|
||||
; Aliases import the aliasee function
|
||||
; CHECK-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2 to void (...)*)
|
||||
; CHECK-DAG: define available_externally void @globalfunc2()
|
||||
declare void @analias(...) #1
|
||||
|
||||
; CHECK-DAG: define available_externally i32 @referencestatics(i32 %i)
|
||||
|
@ -39,4 +44,6 @@ declare void @setfuncptr(...) #1
|
|||
declare void @callfuncptr(...) #1
|
||||
|
||||
; Won't import weak func
|
||||
declare void @callweakfunc(...) #1
|
||||
; CHECK-DAG: declare void @weakfunc(...)
|
||||
declare void @weakfunc(...) #1
|
||||
|
||||
|
|
Loading…
Reference in New Issue