1 ; This test checks to see if scalarrepl also works when a gep with all zeroes is
2 ; used instead of a bitcast to prepare a memmove pointer argument. Previously,
3 ; this would not work when there was a vector involved in the struct, preventing
4 ; scalarrepl from removing the alloca below.
6 ; RUN: opt < %s -scalarrepl -S > %t
7 ; RUN: cat %t | not grep alloca
9 %struct.two = type <{ < 2 x i8 >, i16 }>
11 define void @main(%struct.two* %D, i16 %V) {
13 %S = alloca %struct.two
14 %S.2 = getelementptr %struct.two* %S, i32 0, i32 1
15 store i16 %V, i16* %S.2
16 ; This gep is effectively a bitcast to i8*, but is sometimes generated
17 ; because the type of the first element in %struct.two is i8.
18 %tmpS = getelementptr %struct.two* %S, i32 0, i32 0, i32 0
19 %tmpD = bitcast %struct.two* %D to i8*
20 call void @llvm.memmove.i32(i8* %tmpD, i8* %tmpS, i32 4, i32 1)
24 declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind