1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Linker/comdat.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

33 lines
795 B
LLVM

; RUN: llvm-link %s %p/Inputs/comdat.ll -S -o - | FileCheck %s
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-msvc"
$foo = comdat largest
@foo = global i32 42, comdat($foo)
define i32 @bar() comdat($foo) {
ret i32 42
}
$qux = comdat largest
@qux = global i64 12, comdat($qux)
define i32 @baz() comdat($qux) {
ret i32 12
}
$any = comdat any
@any = global i64 6, comdat($any)
; CHECK: $qux = comdat largest
; CHECK: $foo = comdat largest
; CHECK: $any = comdat any
; CHECK: @foo = global i64 43, comdat{{$}}
; CHECK: @qux = global i64 12, comdat{{$}}
; CHECK: @any = global i64 6, comdat{{$}}
; CHECK-NOT: @in_unselected_group = global i32 13, comdat $qux
; CHECK: define i32 @baz() comdat($qux)
; CHECK: define i32 @bar() comdat($foo)