Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86-64 -mcpu=corei7 -mtriple=x86_64-pc-win64 | FileCheck %s
      2 
      3 ; CHECK: merge_stores_can
      4 ; CHECK: callq foo
      5 ; CHECK: xorps %xmm0, %xmm0
      6 ; CHECK-NEXT: movl 36(%rsp), %ebp
      7 ; CHECK-NEXT: movups  %xmm0
      8 ; CHECK: callq foo
      9 ; CHECK: ret
     10 declare i32 @foo([10 x i32]* )
     11 
     12 define i32 @merge_stores_can() nounwind ssp {
     13   %object1 = alloca [10 x i32]
     14 
     15   %ret0 = call i32 @foo([10 x i32]* %object1) nounwind
     16 
     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
     22 
     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
     28 
     29   %ret1 = call i32 @foo([10 x i32]* %object1) nounwind
     30 
     31   ret i32 %ret
     32 }
     33 
     34 ; CHECK: merge_stores_cant
     35 ; CHECK-NOT: xorps %xmm0, %xmm0
     36 ; CHECK-NOT: movups  %xmm0
     37 ; CHECK: ret
     38 define i32 @merge_stores_cant([10 x i32]* %in0, [10 x i32]* %in1) nounwind ssp {
     39 
     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
     45 
     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
     51 
     52   ret i32 %ret
     53 }
     54