1 ; RUN: llc < %s -mcpu=corei7 -mtriple=x86_64-pc-win64 | FileCheck %s
3 ; CHECK: merge_stores_can
5 ; CHECK: xorps %xmm0, %xmm0
6 ; CHECK-NEXT: movups %xmm0
7 ; CHECK-NEXT: movl 36(%rsp), %ebp
10 declare i32 @foo([10 x i32]* )
12 define i32 @merge_stores_can() nounwind ssp {
13 %object1 = alloca [10 x i32]
15 %ret0 = call i32 @foo([10 x i32]* %object1) nounwind
17 %O1_1 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 1
18 %O1_2 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 2
19 %O1_3 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 3
20 %O1_4 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 4
21 %ld_ptr = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 9
23 store i32 0, i32* %O1_1
24 store i32 0, i32* %O1_2
25 %ret = load i32, i32* %ld_ptr ; <--- does not alias.
26 store i32 0, i32* %O1_3
27 store i32 0, i32* %O1_4
29 %ret1 = call i32 @foo([10 x i32]* %object1) nounwind
34 ; CHECK: merge_stores_cant
35 ; CHECK-NOT: xorps %xmm0, %xmm0
36 ; CHECK-NOT: movups %xmm0
38 define i32 @merge_stores_cant([10 x i32]* %in0, [10 x i32]* %in1) nounwind ssp {
40 %O1_1 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 1
41 %O1_2 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 2
42 %O1_3 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 3
43 %O1_4 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 4
44 %ld_ptr = getelementptr [10 x i32], [10 x i32]* %in0, i64 0, i32 2
46 store i32 0, i32* %O1_1
47 store i32 0, i32* %O1_2
48 %ret = load i32, i32* %ld_ptr ; <--- may alias
49 store i32 0, i32* %O1_3
50 store i32 0, i32* %O1_4