1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/ThinLTO/X86/select_right_alias_definition.ll
Mehdi Amini 8039b6b99a FunctionImport: make sure we always select the right callee in presence of alias
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266854
2016-04-20 04:17:36 +00:00

27 lines
1.1 KiB
LLVM

; RUN: opt -module-summary %s -o %t_main.bc
; RUN: opt -module-summary %p/Inputs/select_right_alias_definition1.ll -o %t1.bc
; RUN: opt -module-summary %p/Inputs/select_right_alias_definition2.ll -o %t2.bc
; Make sure that we always select the right definition for alia foo, whatever
; order the files are linked in.
; Try with one order
; RUN: llvm-lto -thinlto-action=thinlink -o %t.index1.bc %t_main.bc %t1.bc %t2.bc
; RUN: llvm-lto -thinlto-action=import -thinlto-index %t.index1.bc %t_main.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
; Try with the other order (reversing %t1.bc and %t2.bc)
; RUN: llvm-lto -thinlto-action=thinlink -o %t.index2.bc %t_main.bc %t2.bc %t1.bc
; RUN: llvm-lto -thinlto-action=import -thinlto-index %t.index2.bc %t_main.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
; IMPORT: @foo = alias i32 (...), bitcast (i32 ()* @foo2 to i32 (...)*)
; IMPORT: define linkonce_odr i32 @foo2() {
; IMPORT-NEXT: %ret = add i32 42, 42
; IMPORT-NEXT: ret i32 %ret
; IMPORT-NEXT: }
declare i32 @foo()
define i32 @main() {
%ret = call i32 @foo()
ret i32 %ret
}