1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 21:13:02 +02:00
llvm-mirror/test/CodeGen/ARM/aliases.ll
John Brawn dcf7a81cdd Redo "Make global aliases have symbol size equal to their type"
r242520 was reverted in r244313 as the expected behaviour of the alias
attribute in C is that the alias has the same size as the aliasee. However
we can re-introduce adding the size on the alias when the aliasee does not,
from a source code or object perspective, exist as a discrete entity. This
happens when the aliasee is not a symbol, or when that symbol is private.

Differential Revision: http://reviews.llvm.org/D11943

llvm-svn: 244752
2015-08-12 15:05:39 +00:00

67 lines
1.3 KiB
LLVM

; RUN: llc < %s -mtriple=arm-linux-gnueabi | FileCheck %s
; CHECK: .globl test
; CHECK: .Lstructvar:
; CHECK: .size .Lstructvar, 8
; CHECK: .globl foo1
; CHECK: foo1 = bar
; CHECK-NOT: .size foo1
; CHECK: .globl foo2
; CHECK: foo2 = bar
; CHECK-NOT: .size foo2
; CHECK: .weak bar_f
; CHECK: bar_f = foo_f
; CHECK-NOT: .size bar_f
; CHECK: bar_i = bar
; CHECK-NOT: .size bar_i
; CHECK: .globl A
; CHECK: A = bar
; CHECK-NOT: .size A
; CHECK: .globl elem0
; CHECK: elem0 = .Lstructvar
; CHECK: .size elem0, 4
; CHECK: .globl elem1
; CHECK: elem1 = .Lstructvar+4
; CHECK: .size elem1, 4
@bar = global i32 42
@foo1 = alias i32* @bar
@foo2 = alias i32* @bar
%FunTy = type i32()
define i32 @foo_f() {
ret i32 0
}
@bar_f = weak alias %FunTy* @foo_f
@bar_i = internal alias i32* @bar
@A = alias bitcast (i32* @bar to i64*)
@structvar = private global {i32, i32} {i32 1, i32 2}
@elem0 = alias getelementptr({i32, i32}, {i32, i32}* @structvar, i32 0, i32 0)
@elem1 = alias getelementptr({i32, i32}, {i32, i32}* @structvar, i32 0, i32 1)
define i32 @test() {
entry:
%tmp = load i32, i32* @foo1
%tmp1 = load i32, i32* @foo2
%tmp0 = load i32, i32* @bar_i
%tmp2 = call i32 @foo_f()
%tmp3 = add i32 %tmp, %tmp2
%tmp4 = call i32 @bar_f()
%tmp5 = add i32 %tmp3, %tmp4
%tmp6 = add i32 %tmp1, %tmp5
%tmp7 = add i32 %tmp6, %tmp0
ret i32 %tmp7
}