summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Linker/funcimport.ll12
-rw-r--r--llvm/test/Transforms/FunctionImport/funcimport.ll11
-rw-r--r--llvm/test/Verifier/alias.ll6
3 files changed, 23 insertions, 6 deletions
diff --git a/llvm/test/Linker/funcimport.ll b/llvm/test/Linker/funcimport.ll
index d6aa0502f26..8a71e21d0ad 100644
--- a/llvm/test/Linker/funcimport.ll
+++ b/llvm/test/Linker/funcimport.ll
@@ -36,7 +36,7 @@
; turned into a declaration, but that strong alias to an imported function
; is imported as alias.
; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc2:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB2
-; IMPORTGLOB2-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2
+; IMPORTGLOB2-DAG: declare void @analias()
; IMPORTGLOB2-DAG: declare void @globalfunc1
; IMPORTGLOB2-DAG: define available_externally void @globalfunc2
; IMPORTGLOB2-DAG: declare extern_weak void @weakalias
@@ -44,7 +44,7 @@
; Ensure that strong alias imported in second pass of importing ends up
; as an alias.
; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc1:%t.bc -import=globalfunc2:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB3
-; IMPORTGLOB3-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2
+; IMPORTGLOB3-DAG: declare void @analias()
; IMPORTGLOB3-DAG: define available_externally void @globalfunc1
; IMPORTGLOB3-DAG: define available_externally void @globalfunc2
; IMPORTGLOB3-DAG: declare extern_weak void @weakalias
@@ -53,11 +53,17 @@
; as an alias, and that seeing the alias definition during a second inlining
; pass is handled correctly.
; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc2:%t.bc -import=globalfunc1:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB4
-; IMPORTGLOB4-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2
+; IMPORTGLOB4-DAG: declare void @analias()
; IMPORTGLOB4-DAG: define available_externally void @globalfunc2
; IMPORTGLOB4-DAG: define available_externally void @globalfunc1
; IMPORTGLOB4-DAG: declare extern_weak void @weakalias
+; An alias to an imported function is imported as alias if the function is not
+; available_externally.
+; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=linkoncefunc:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB5
+; IMPORTGLOB5-DAG: linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
+; IMPORTGLOB5-DAG: define linkonce_odr void @linkoncefunc()
+
; Ensure that imported static variable and function references are correctly
; promoted and renamed (including static constant variable).
; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referencestatics:%t.bc -S | FileCheck %s --check-prefix=IMPORTSTATIC
diff --git a/llvm/test/Transforms/FunctionImport/funcimport.ll b/llvm/test/Transforms/FunctionImport/funcimport.ll
index 57452b1ec53..2c9164fdaa9 100644
--- a/llvm/test/Transforms/FunctionImport/funcimport.ll
+++ b/llvm/test/Transforms/FunctionImport/funcimport.ll
@@ -14,6 +14,7 @@ define i32 @main() #0 {
entry:
call void (...) @weakalias()
call void (...) @analias()
+ call void (...) @linkoncealias()
%call = call i32 (...) @referencestatics()
%call1 = call i32 (...) @referenceglobals()
%call2 = call i32 (...) @referencecommon()
@@ -27,11 +28,15 @@ entry:
; 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()
+; Cannot create an alias to available_externally
+; CHECK-DAG: declare void @analias()
declare void @analias(...) #1
+; Aliases import the aliasee function
+declare void @linkoncealias(...) #1
+; CHECK-DAG: define linkonce_odr void @linkoncefunc()
+; CHECK-DAG: @linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*
+
; INSTLIMDEF-DAG: define available_externally i32 @referencestatics(i32 %i)
; INSTLIM5-DAG: declare i32 @referencestatics(...)
declare i32 @referencestatics(...) #1
diff --git a/llvm/test/Verifier/alias.ll b/llvm/test/Verifier/alias.ll
index 3fb140464ec..1847c0d4214 100644
--- a/llvm/test/Verifier/alias.ll
+++ b/llvm/test/Verifier/alias.ll
@@ -11,6 +11,12 @@ declare void @f()
; CHECK: Alias must point to a definition
; CHECK-NEXT: @ga
+define available_externally void @f2() {
+ ret void
+}
+@fa2 = alias void(), void()* @f2
+; CHECK: Alias must point to a definition
+; CHECK-NEXT: @fa2
@test2_a = alias i32, i32* @test2_b
@test2_b = alias i32, i32* @test2_a
OpenPOWER on IntegriCloud