mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
d57120551f
Before this patch we had @a = weak global ... but @b = alias weak ... The patch changes aliases to look more like global variables. Looking at some really old code suggests that the reason was that the old bison based parser had a reduction for alias linkages and another one for global variable linkages. Putting the alias first avoided the reduce/reduce conflict. The days of the old .ll parser are long gone. The new one parses just "linkage" and a later check is responsible for deciding if a linkage is valid in a given context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214355 91177308-0d34-0410-b5e6-96231b3b80d8
48 lines
1.5 KiB
LLVM
48 lines
1.5 KiB
LLVM
; RUN: opt < %s -globalopt -S | FileCheck %s
|
|
|
|
@c = global i8 42
|
|
|
|
@i = internal global i8 42
|
|
; CHECK: @ia = internal global i8 42
|
|
@ia = internal alias i8* @i
|
|
|
|
@llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
|
|
; CHECK-DAG: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
|
|
|
|
@llvm.compiler.used = appending global [4 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* bitcast (void ()* @fa to i8*), i8* @ia, i8* @i], section "llvm.metadata"
|
|
; CHECK-DAG: @llvm.compiler.used = appending global [2 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* @ia], section "llvm.metadata"
|
|
|
|
@sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca]
|
|
; CHECK-DAG: @sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @f to i8*), i8* bitcast (void ()* @f to i8*), i8* @c]
|
|
|
|
@other = global i32* bitcast (void ()* @fa to i32*)
|
|
; CHECK-DAG: @other = global i32* bitcast (void ()* @f to i32*)
|
|
|
|
@fa = internal alias void ()* @f
|
|
; CHECK: @fa = internal alias void ()* @f
|
|
|
|
@fa2 = internal alias void ()* @f
|
|
; CHECK-NOT: @fa2
|
|
|
|
@fa3 = internal alias void ()* @f
|
|
; CHECK: @fa3
|
|
|
|
@ca = internal alias i8* @c
|
|
; CHECK: @ca = internal alias i8* @c
|
|
|
|
define void @f() {
|
|
ret void
|
|
}
|
|
|
|
define i8* @g() {
|
|
ret i8* bitcast (void ()* @fa to i8*);
|
|
}
|
|
|
|
define i8* @g2() {
|
|
ret i8* bitcast (void ()* @fa2 to i8*);
|
|
}
|
|
|
|
define i8* @h() {
|
|
ret i8* @ca
|
|
}
|