blob: fe702fa21772369a3c8e80442420ca0f6652bfb1 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; PR892
Dan Gohman3c7d3082009-09-11 18:01:28 +00002; RUN: opt < %s -scalarrepl -S | \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003; RUN: not grep alloca
Dan Gohman3c7d3082009-09-11 18:01:28 +00004; RUN: opt < %s -scalarrepl -S | grep {ret i8}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005
Tanya Lattner307f46e2008-03-18 04:14:37 +00006target datalayout = "e-p:32:32"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007target triple = "i686-apple-darwin8.7.2"
Tanya Lattner307f46e2008-03-18 04:14:37 +00008 %struct.Val = type { i32*, i32 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009
Tanya Lattner307f46e2008-03-18 04:14:37 +000010define i8* @test(i16* %X) {
11 %X_addr = alloca i16* ; <i16**> [#uses=2]
12 store i16* %X, i16** %X_addr
13 %X_addr.upgrd.1 = bitcast i16** %X_addr to i8** ; <i8**> [#uses=1]
14 %tmp = load i8** %X_addr.upgrd.1 ; <i8*> [#uses=1]
15 ret i8* %tmp
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016}
17
Tanya Lattner307f46e2008-03-18 04:14:37 +000018define void @test2(i64 %Op.0) {
19 %tmp = alloca %struct.Val, align 8 ; <%struct.Val*> [#uses=3]
20 %tmp1 = alloca %struct.Val, align 8 ; <%struct.Val*> [#uses=3]
21 %tmp.upgrd.2 = call i64 @_Z3foov( ) ; <i64> [#uses=1]
22 %tmp1.upgrd.3 = bitcast %struct.Val* %tmp1 to i64* ; <i64*> [#uses=1]
23 store i64 %tmp.upgrd.2, i64* %tmp1.upgrd.3
24 %tmp.upgrd.4 = getelementptr %struct.Val* %tmp, i32 0, i32 0 ; <i32**> [#uses=1]
25 %tmp2 = getelementptr %struct.Val* %tmp1, i32 0, i32 0 ; <i32**> [#uses=1]
26 %tmp.upgrd.5 = load i32** %tmp2 ; <i32*> [#uses=1]
27 store i32* %tmp.upgrd.5, i32** %tmp.upgrd.4
28 %tmp3 = getelementptr %struct.Val* %tmp, i32 0, i32 1 ; <i32*> [#uses=1]
29 %tmp4 = getelementptr %struct.Val* %tmp1, i32 0, i32 1 ; <i32*> [#uses=1]
30 %tmp.upgrd.6 = load i32* %tmp4 ; <i32> [#uses=1]
31 store i32 %tmp.upgrd.6, i32* %tmp3
32 %tmp7 = bitcast %struct.Val* %tmp to { i64 }* ; <{ i64 }*> [#uses=1]
33 %tmp8 = getelementptr { i64 }* %tmp7, i32 0, i32 0 ; <i64*> [#uses=1]
34 %tmp9 = load i64* %tmp8 ; <i64> [#uses=1]
35 call void @_Z3bar3ValS_( i64 %Op.0, i64 %tmp9 )
36 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037}
38
Tanya Lattner307f46e2008-03-18 04:14:37 +000039declare i64 @_Z3foov()
Dan Gohmanf17a25c2007-07-18 16:29:46 +000040
Tanya Lattner307f46e2008-03-18 04:14:37 +000041declare void @_Z3bar3ValS_(i64, i64)