1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Linker/override-different-linkage.ll
Duncan P. N. Exon Smith 272b8f5b73 Linker: Add flag to override linkage rules
Add a flag to lib/Linker (and `llvm-link`) to override linkage rules.
When set, the functions in the source module *always* replace those in
the destination module.

The `llvm-link` option is `-override=abc.ll`.  All the "regular" modules
are loaded and linked first, followed by the `-override` modules.  This
is useful for debugging workflows where some subset of the module (e.g.,
a single function) is extracted into a separate file where it's
optimized differently, before being merged back in.

Patch by Luqman Aden!

llvm-svn: 235473
2015-04-22 04:11:00 +00:00

20 lines
478 B
LLVM

; RUN: llvm-link %s -override %S/Inputs/override-different-linkage.ll -S | FileCheck %s
; RUN: llvm-link -override %S/Inputs/override-different-linkage.ll %s -S | FileCheck %s
; CHECK-LABEL: define linkonce i32 @foo
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 4
define weak i32 @foo(i32 %i) {
entry:
%add = add nsw i32 %i, %i
ret i32 %add
}
; Function Attrs: nounwind ssp uwtable
define i32 @main(i32 %argc, i8** %argv) {
entry:
%a = call i32 @foo(i32 2)
ret i32 %a
}