blob: f54704cd499d5e9b5a9b73efa03db9cd49531a54 [file] [log] [blame]
Chris Lattnerfc1dfd42006-10-08 23:27:37 +00001; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca &&
2; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep 'ret sbyte'
3
Chris Lattnereab5bd32006-10-08 23:52:06 +00004; PR892
5
Chris Lattnerfc1dfd42006-10-08 23:27:37 +00006target endian = little
7target pointersize = 32
8target triple = "i686-apple-darwin8.7.2"
Chris Lattnereab5bd32006-10-08 23:52:06 +00009
10%struct.Val = type { int*, int }
Chris Lattnerfc1dfd42006-10-08 23:27:37 +000011
12implementation ; Functions:
13
14sbyte* %test(short* %X) {
15 %X_addr = alloca short*
16 store short* %X, short** %X_addr
17 %X_addr = cast short** %X_addr to sbyte**
18 %tmp = load sbyte** %X_addr
19 ret sbyte* %tmp
20}
21
Chris Lattnereab5bd32006-10-08 23:52:06 +000022void %test2(long %Op.0) {
23 %tmp = alloca %struct.Val, align 8
24 %tmp1 = alloca %struct.Val, align 8
25 %tmp = call ulong %_Z3foov( )
26 %tmp1 = cast %struct.Val* %tmp1 to ulong*
27 store ulong %tmp, ulong* %tmp1
28 %tmp = getelementptr %struct.Val* %tmp, int 0, uint 0
29 %tmp2 = getelementptr %struct.Val* %tmp1, int 0, uint 0
30 %tmp = load int** %tmp2
31 store int* %tmp, int** %tmp
32 %tmp3 = getelementptr %struct.Val* %tmp, int 0, uint 1
33 %tmp4 = getelementptr %struct.Val* %tmp1, int 0, uint 1
34 %tmp = load int* %tmp4
35 store int %tmp, int* %tmp3
36 %tmp7 = cast %struct.Val* %tmp to { long }*
37 %tmp8 = getelementptr { long }* %tmp7, int 0, uint 0
38 %tmp9 = load long* %tmp8
39 call void %_Z3bar3ValS_( long %Op.0, long %tmp9 )
40 ret void
41}
42
43declare ulong %_Z3foov()
44
45declare void %_Z3bar3ValS_(long, long)
46