Home | History | Annotate | Download | only in ScalarRepl
      1 ; RUN: opt < %s -scalarrepl -S | \
      2 ; RUN:   not grep alloca
      3 
      4 target datalayout = "E-p:32:32"
      5 target triple = "powerpc-apple-darwin8.0.0"
      6 
      7 define i64 @test1(i64 %X) {
      8 	%A = alloca i64		; <i64*> [#uses=3]
      9 	store i64 %X, i64* %A
     10 	%B = bitcast i64* %A to i32*		; <i32*> [#uses=1]
     11 	%C = bitcast i32* %B to i8*		; <i8*> [#uses=1]
     12 	store i8 0, i8* %C
     13 	%Y = load i64* %A		; <i64> [#uses=1]
     14 	ret i64 %Y
     15 }
     16 
     17 define i8 @test2(i64 %X) {
     18 	%X_addr = alloca i64		; <i64*> [#uses=2]
     19 	store i64 %X, i64* %X_addr
     20 	%tmp.0 = bitcast i64* %X_addr to i32*		; <i32*> [#uses=1]
     21 	%tmp.1 = getelementptr i32* %tmp.0, i32 1		; <i32*> [#uses=1]
     22 	%tmp.2 = bitcast i32* %tmp.1 to i8*		; <i8*> [#uses=1]
     23 	%tmp.3 = getelementptr i8* %tmp.2, i32 3		; <i8*> [#uses=1]
     24 	%tmp.2.upgrd.1 = load i8* %tmp.3		; <i8> [#uses=1]
     25 	ret i8 %tmp.2.upgrd.1
     26 }
     27 
     28 define i16 @crafty(i64 %X) {
     29 	%a = alloca { i64 }		; <{ i64 }*> [#uses=2]
     30 	%tmp.0 = getelementptr { i64 }* %a, i32 0, i32 0		; <i64*> [#uses=1]
     31 	store i64 %X, i64* %tmp.0
     32 	%tmp.3 = bitcast { i64 }* %a to [4 x i16]*		; <[4 x i16]*> [#uses=2]
     33 	%tmp.4 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 3		; <i16*> [#uses=1]
     34 	%tmp.5 = load i16* %tmp.4		; <i16> [#uses=1]
     35 	%tmp.8 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 2		; <i16*> [#uses=1]
     36 	%tmp.9 = load i16* %tmp.8		; <i16> [#uses=1]
     37 	%tmp.10 = or i16 %tmp.9, %tmp.5		; <i16> [#uses=1]
     38 	ret i16 %tmp.10
     39 }
     40 
     41 define i16 @crafty2(i64 %X) {
     42 	%a = alloca i64		; <i64*> [#uses=2]
     43 	store i64 %X, i64* %a
     44 	%tmp.3 = bitcast i64* %a to [4 x i16]*		; <[4 x i16]*> [#uses=2]
     45 	%tmp.4 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 3		; <i16*> [#uses=1]
     46 	%tmp.5 = load i16* %tmp.4		; <i16> [#uses=1]
     47 	%tmp.8 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 2		; <i16*> [#uses=1]
     48 	%tmp.9 = load i16* %tmp.8		; <i16> [#uses=1]
     49 	%tmp.10 = or i16 %tmp.9, %tmp.5		; <i16> [#uses=1]
     50 	ret i16 %tmp.10
     51 }
     52