1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Linker/ctors.ll
Jin Lin 673715d427 Preserve the lexical order for global variables during llvm-link merge
The order of global variables is generated in the order of recursively materializing variables if the global variable has the attribute of hasLocalLinkage or hasLinkOnceLinkage during the module merging. In practice, it is often the exact reverse of source order. This new order may cause performance regression.

The change is to preserve the original lexical order for global variables.

Reviewed By: jdoerfert, dexonsmith

Differential Revision: https://reviews.llvm.org/D94202
2021-04-26 10:11:34 -07:00

19 lines
713 B
LLVM

; RUN: llvm-link %s %p/Inputs/ctors.ll -S -o - | \
; RUN: FileCheck --check-prefix=ALL --check-prefix=CHECK1 %s
; RUN: llvm-link %p/Inputs/ctors.ll %s -S -o - | \
; RUN: FileCheck --check-prefix=ALL --check-prefix=CHECK2 %s
; Test the bitcode writer too. It used to crash.
; RUN: llvm-link %s %p/Inputs/ctors.ll -o %t.bc
; ALL: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* @v }]
@v = weak global i8 0
; CHECK1: @v = weak global i8 0
; CHECK2: @v = weak global i8 1
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* @v }]
define weak void @f() {
ret void
}