mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
f907a26bc2
In order to make comdats always explicit in the IR, we decided to make the syntax a bit more compact for the case of a GlobalObject in a comdat with the same name. Just dropping the $name causes problems for @foo = globabl i32 0, comdat $bar = comdat ... and declare void @foo() comdat $bar = comdat ... So the syntax is changed to @g1 = globabl i32 0, comdat($c1) @g2 = globabl i32 0, comdat and declare void @foo() comdat($c1) declare void @foo() comdat git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225302 91177308-0d34-0410-b5e6-96231b3b80d8
38 lines
1.1 KiB
LLVM
38 lines
1.1 KiB
LLVM
; RUN: opt -globalopt -S < %s | FileCheck %s
|
|
|
|
$comdat_global = comdat any
|
|
|
|
@comdat_global = weak_odr global i8 0, comdat($comdat_global)
|
|
@simple_global = internal global i8 0
|
|
; CHECK: @comdat_global = weak_odr global i8 0, comdat{{$}}
|
|
; CHECK: @simple_global = internal global i8 42
|
|
|
|
@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [
|
|
{ i32, void ()*, i8* } { i32 65535, void ()* @init_comdat_global, i8* @comdat_global },
|
|
{ i32, void ()*, i8* } { i32 65535, void ()* @init_simple_global, i8* null }
|
|
]
|
|
; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }]
|
|
; CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @init_comdat_global, i8* @comdat_global }]
|
|
|
|
define void @init_comdat_global() {
|
|
store i8 42, i8* @comdat_global
|
|
ret void
|
|
}
|
|
; CHECK: define void @init_comdat_global()
|
|
|
|
define internal void @init_simple_global() comdat($comdat_global) {
|
|
store i8 42, i8* @simple_global
|
|
ret void
|
|
}
|
|
; CHECK-NOT: @init_simple_global()
|
|
|
|
define i8* @use_simple() {
|
|
ret i8* @simple_global
|
|
}
|
|
; CHECK: define i8* @use_simple()
|
|
|
|
define i8* @use_comdat() {
|
|
ret i8* @comdat_global
|
|
}
|
|
; CHECK: define i8* @use_comdat()
|