comparison test/CodeGen/X86/2012-11-28-merge-store-alias.ll @ 95:afa8332a0e37

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 95c75e76d11b
children 803732b1fca8
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
1 ; RUN: llc < %s -march=x86-64 -mcpu=corei7 -mtriple=x86_64-pc-win64 | FileCheck %s 1 ; RUN: llc < %s -march=x86-64 -mcpu=corei7 -mtriple=x86_64-pc-win64 | FileCheck %s
2 2
3 ; CHECK: merge_stores_can 3 ; CHECK: merge_stores_can
4 ; CHECK: callq foo 4 ; CHECK: callq foo
5 ; CHECK-NEXT: xorps %xmm0, %xmm0 5 ; CHECK: xorps %xmm0, %xmm0
6 ; CHECK-NEXT: movl 36(%rsp), %ebp
6 ; CHECK-NEXT: movups %xmm0 7 ; CHECK-NEXT: movups %xmm0
7 ; CHECK: callq foo 8 ; CHECK: callq foo
8 ; CHECK: ret 9 ; CHECK: ret
9 declare i32 @foo([10 x i32]* ) 10 declare i32 @foo([10 x i32]* )
10 11
11 define i32 @merge_stores_can() nounwind ssp { 12 define i32 @merge_stores_can() nounwind ssp {
12 %object1 = alloca [10 x i32] 13 %object1 = alloca [10 x i32]
13 14
14 %ret0 = call i32 @foo([10 x i32]* %object1) nounwind 15 %ret0 = call i32 @foo([10 x i32]* %object1) nounwind
15 16
16 %O1_1 = getelementptr [10 x i32]* %object1, i64 0, i32 1 17 %O1_1 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 1
17 %O1_2 = getelementptr [10 x i32]* %object1, i64 0, i32 2 18 %O1_2 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 2
18 %O1_3 = getelementptr [10 x i32]* %object1, i64 0, i32 3 19 %O1_3 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 3
19 %O1_4 = getelementptr [10 x i32]* %object1, i64 0, i32 4 20 %O1_4 = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 4
20 %ld_ptr = getelementptr [10 x i32]* %object1, i64 0, i32 9 21 %ld_ptr = getelementptr [10 x i32], [10 x i32]* %object1, i64 0, i32 9
21 22
22 store i32 0, i32* %O1_1 23 store i32 0, i32* %O1_1
23 store i32 0, i32* %O1_2 24 store i32 0, i32* %O1_2
24 %ret = load i32* %ld_ptr ; <--- does not alias. 25 %ret = load i32, i32* %ld_ptr ; <--- does not alias.
25 store i32 0, i32* %O1_3 26 store i32 0, i32* %O1_3
26 store i32 0, i32* %O1_4 27 store i32 0, i32* %O1_4
27 28
28 %ret1 = call i32 @foo([10 x i32]* %object1) nounwind 29 %ret1 = call i32 @foo([10 x i32]* %object1) nounwind
29 30
34 ; CHECK-NOT: xorps %xmm0, %xmm0 35 ; CHECK-NOT: xorps %xmm0, %xmm0
35 ; CHECK-NOT: movups %xmm0 36 ; CHECK-NOT: movups %xmm0
36 ; CHECK: ret 37 ; CHECK: ret
37 define i32 @merge_stores_cant([10 x i32]* %in0, [10 x i32]* %in1) nounwind ssp { 38 define i32 @merge_stores_cant([10 x i32]* %in0, [10 x i32]* %in1) nounwind ssp {
38 39
39 %O1_1 = getelementptr [10 x i32]* %in1, i64 0, i32 1 40 %O1_1 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 1
40 %O1_2 = getelementptr [10 x i32]* %in1, i64 0, i32 2 41 %O1_2 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 2
41 %O1_3 = getelementptr [10 x i32]* %in1, i64 0, i32 3 42 %O1_3 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 3
42 %O1_4 = getelementptr [10 x i32]* %in1, i64 0, i32 4 43 %O1_4 = getelementptr [10 x i32], [10 x i32]* %in1, i64 0, i32 4
43 %ld_ptr = getelementptr [10 x i32]* %in0, i64 0, i32 2 44 %ld_ptr = getelementptr [10 x i32], [10 x i32]* %in0, i64 0, i32 2
44 45
45 store i32 0, i32* %O1_1 46 store i32 0, i32* %O1_1
46 store i32 0, i32* %O1_2 47 store i32 0, i32* %O1_2
47 %ret = load i32* %ld_ptr ; <--- may alias 48 %ret = load i32, i32* %ld_ptr ; <--- may alias
48 store i32 0, i32* %O1_3 49 store i32 0, i32* %O1_3
49 store i32 0, i32* %O1_4 50 store i32 0, i32* %O1_4
50 51
51 ret i32 %ret 52 ret i32 %ret
52 } 53 }